Added function process_files
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -26,7 +26,7 @@ def sourcedir_filecnt(sourcedir):
|
|||||||
if file.lower().endswith('.h'):
|
if file.lower().endswith('.h'):
|
||||||
cnt += 1
|
cnt += 1
|
||||||
filelist += [file]
|
filelist += [file]
|
||||||
print(filelist)
|
#print(filelist)
|
||||||
return cnt
|
return cnt
|
||||||
|
|
||||||
def sourcedir_foldercnt(sourcedir):
|
def sourcedir_foldercnt(sourcedir):
|
||||||
@@ -42,16 +42,25 @@ def sourcedir_foldercnt(sourcedir):
|
|||||||
cnt = cnt+1
|
cnt = cnt+1
|
||||||
print(folderName)
|
print(folderName)
|
||||||
folderlist += [folderName]
|
folderlist += [folderName]
|
||||||
print(folderlist)
|
#print(folderlist)
|
||||||
|
#print(len(folderlist))
|
||||||
return cnt
|
return cnt
|
||||||
|
|
||||||
def process_files(sourcedir, destdir):
|
def process_files(sourcedir, destdir):
|
||||||
WorkPath = os.path.dirname(sourcedir)
|
global folderlist
|
||||||
print(WorkPath)
|
global filelist
|
||||||
incpath = destdir
|
cnt = 0
|
||||||
print(incpath)
|
for f in folderlist:
|
||||||
if not os.path.exists(incpath):
|
folderlist[cnt] = str(f).replace(str(sourcedir.get()), str(destdir.get()))
|
||||||
os.makedirs(incpath)
|
print(folderlist[cnt])
|
||||||
pattern = '.h'
|
if not os.path.exists(folderlist[cnt]):
|
||||||
inputfile = 'gtkaboutdialog.h'
|
os.makedirs(folderlist[cnt])
|
||||||
filehandle = open(WorkPath+'/'+inputfile, 'r')
|
cnt += 1
|
||||||
|
#WorkPath = os.path.dirname(sourcedir)
|
||||||
|
#print(WorkPath)
|
||||||
|
#incpath = destdir
|
||||||
|
#print(incpath)
|
||||||
|
|
||||||
|
#pattern = '.h'
|
||||||
|
#inputfile = 'gtkaboutdialog.h'
|
||||||
|
#filehandle = open(WorkPath+'/'+inputfile, 'r')
|
||||||
+3
-2
@@ -15,7 +15,7 @@ import os
|
|||||||
from os.path import expanduser
|
from os.path import expanduser
|
||||||
import platform
|
import platform
|
||||||
import sys
|
import sys
|
||||||
from h2inc import sourcedir_filecnt, sourcedir_foldercnt
|
from h2inc import sourcedir_filecnt, sourcedir_foldercnt, process_files
|
||||||
|
|
||||||
class h2incGUI:
|
class h2incGUI:
|
||||||
def __init__(self, master):
|
def __init__(self, master):
|
||||||
@@ -137,7 +137,7 @@ class h2incGUI:
|
|||||||
doinc = addinc.get()
|
doinc = addinc.get()
|
||||||
dest = destdir.get()
|
dest = destdir.get()
|
||||||
if doinc == 'yes':
|
if doinc == 'yes':
|
||||||
dest = dest+'/include/'
|
dest = dest+'/include'
|
||||||
print(os.path.exists(os.path.dirname(dest)))
|
print(os.path.exists(os.path.dirname(dest)))
|
||||||
if not os.path.exists(os.path.dirname(dest)):
|
if not os.path.exists(os.path.dirname(dest)):
|
||||||
try:
|
try:
|
||||||
@@ -147,6 +147,7 @@ class h2incGUI:
|
|||||||
raise
|
raise
|
||||||
destdir.set(dest)
|
destdir.set(dest)
|
||||||
print ('Destination directory: ', destdir.get())
|
print ('Destination directory: ', destdir.get())
|
||||||
|
process_files(sourcedir, destdir)
|
||||||
|
|
||||||
|
|
||||||
root = Tk()
|
root = Tk()
|
||||||
|
|||||||
Reference in New Issue
Block a user