mirror of
https://github.com/HelloZeroNet/ZeroNet.git
synced 2023-12-14 04:33:03 +01:00
Fix file merge order on Linux
This commit is contained in:
parent
50708c16de
commit
ff681adfe9
1 changed files with 11 additions and 1 deletions
|
@ -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]
|
||||
|
|
Loading…
Reference in a new issue