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