Add files via upload
Updated process_files
This commit is contained in:
@@ -25,7 +25,7 @@ def sourcedir_filecnt(sourcedir):
|
|||||||
if file.lower().endswith('.h'):
|
if file.lower().endswith('.h'):
|
||||||
cnt += 1
|
cnt += 1
|
||||||
filelist += [folderName+'/'+file]
|
filelist += [folderName+'/'+file]
|
||||||
print(folderName+'/'+file)
|
print(folderName+'/'+file)
|
||||||
#print(filelist)
|
#print(filelist)
|
||||||
return cnt
|
return cnt
|
||||||
|
|
||||||
@@ -55,20 +55,24 @@ def process_files(sourcedir, destdir):
|
|||||||
for f in filelist:
|
for f in filelist:
|
||||||
inputfile = f
|
inputfile = f
|
||||||
filehandle = open(f, 'r')
|
filehandle = open(f, 'r')
|
||||||
cnt += 1
|
#cnt += 1
|
||||||
|
print(os.path.basename(f))
|
||||||
for lines in filehandle:
|
for lines in filehandle:
|
||||||
|
print(lines)
|
||||||
preproc = preproc+tuple([parseline(lines)])
|
preproc = preproc+tuple([parseline(lines)])
|
||||||
filehandle.close()
|
filehandle.close()
|
||||||
for elements in preproc:
|
for elements in preproc:
|
||||||
outfile = outfile+parseparsed(elements)
|
outfile = outfile+parseparsed(elements)
|
||||||
outputfile = os.path.splitext(inputfile)[0]+'.inc'
|
outputfile = os.path.splitext(inputfile)[0]+'.inc'
|
||||||
outputfile = str(outputfile).replace(str(sourcedir.get()), str(destdir.get()))
|
outputfile = str(outputfile).replace(str(sourcedir.get()), str(destdir.get()))
|
||||||
#if not os.path.exists(filelist[cnt]):
|
print(outputfile)
|
||||||
#try:
|
if not os.path.exists(os.path.dirname(outputfile)):
|
||||||
#os.makedirs(output)
|
try:
|
||||||
#except OSError as exc: # Guard against race condition
|
os.makedirs(os.path.dirname(outputfile))
|
||||||
#if exc.errno != errno.EEXIST:
|
except OSError as exc: # Guard against race condition
|
||||||
#raise
|
if exc.errno != errno.EEXIST:
|
||||||
|
raise
|
||||||
newfile = open(outputfile, "w")
|
newfile = open(outputfile, "w")
|
||||||
newfile.write(outfile)
|
newfile.write(outfile)
|
||||||
newfile.close()
|
newfile.close()
|
||||||
|
cnt += 1
|
||||||
|
|||||||
Reference in New Issue
Block a user