Fix file merge order on Linux

This commit is contained in:
HelloZeroNet 2016-03-18 23:52:16 +01:00
parent 50708c16de
commit ff681adfe9

View file

@ -10,7 +10,17 @@ from util import helper
# Find files with extension in path
def findfiles(path, find_ext):
for root, dirs, files in os.walk(path, topdown=False):
def sorter(f1, f2):
f1 = f1[0].replace(path, "")
f2 = f2[0].replace(path, "")
if f1 == "":
return 1
elif f2 == "":
return -1
else:
return cmp(f1, f2)
for root, dirs, files in sorted(os.walk(path, topdown=False), cmp=sorter):
for file in sorted(files):
file_path = root + "/" + file
file_ext = file.split(".")[-1]