diff --git a/__pycache__/h2inc.cpython-35.pyc b/__pycache__/h2inc.cpython-35.pyc index 516138e..57272df 100644 Binary files a/__pycache__/h2inc.cpython-35.pyc and b/__pycache__/h2inc.cpython-35.pyc differ diff --git a/__pycache__/h2inc_gui.cpython-35.pyc b/__pycache__/h2inc_gui.cpython-35.pyc index cf7859b..2f74536 100644 Binary files a/__pycache__/h2inc_gui.cpython-35.pyc and b/__pycache__/h2inc_gui.cpython-35.pyc differ diff --git a/h2inc.py b/h2inc.py index 658bbd8..02d6b2a 100644 --- a/h2inc.py +++ b/h2inc.py @@ -12,7 +12,6 @@ import h2inc_gui tupline = [] preproc = () -outfile = '' filelist = [] folderlist = [] cnt = 0 @@ -25,7 +24,8 @@ def sourcedir_filecnt(sourcedir): for file in files: if file.lower().endswith('.h'): cnt += 1 - filelist += [file] + filelist += [folderName+'/'+file] + print(folderName+'/'+file) #print(filelist) return cnt @@ -40,27 +40,35 @@ def sourcedir_foldercnt(sourcedir): tempf = [file for file in files if file.lower().endswith('.h')] if tempf: cnt = cnt+1 - print(folderName) + #print(folderName) folderlist += [folderName] #print(folderlist) #print(len(folderlist)) return cnt def process_files(sourcedir, destdir): - global folderlist + #global folderlist global filelist + global preproc + outfile = '' 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]) + for f in filelist: + inputfile = f + filehandle = open(f, 'r') cnt += 1 - #WorkPath = os.path.dirname(sourcedir) - #print(WorkPath) - #incpath = destdir - #print(incpath) - - #pattern = '.h' - #inputfile = 'gtkaboutdialog.h' - #filehandle = open(WorkPath+'/'+inputfile, 'r') \ No newline at end of file + for lines in filehandle: + preproc = preproc+tuple([parseline(lines)]) + filehandle.close() + for elements in preproc: + outfile = outfile+parseparsed(elements) + outputfile = os.path.splitext(inputfile)[0]+'.inc' + outputfile = str(outputfile).replace(str(sourcedir.get()), str(destdir.get())) + #if not os.path.exists(filelist[cnt]): + #try: + #os.makedirs(output) + #except OSError as exc: # Guard against race condition + #if exc.errno != errno.EEXIST: + #raise + newfile = open(outputfile, "w") + newfile.write(outfile) + newfile.close()