MCPcopy
hub / github.com/HelloZeroNet/ZeroNet / findfiles

Function findfiles

src/Debug/DebugMedia.py:13–29  ·  view source on GitHub ↗
(path, find_ext)

Source from the content-addressed store, hash-verified

11
12# Find files with extension in path
13def findfiles(path, find_ext):
14 def sorter(f1, f2):
15 f1 = f1[0].replace(path, "")
16 f2 = f2[0].replace(path, "")
17 if f1 == "":
18 return 1
19 elif f2 == "":
20 return -1
21 else:
22 return helper.cmp(f1.lower(), f2.lower())
23
24 for root, dirs, files in sorted(os.walk(path, topdown=False), key=functools.cmp_to_key(sorter)):
25 for file in sorted(files):
26 file_path = root + "/" + file
27 file_ext = file.split(".")[-1]
28 if file_ext in find_ext and not file.startswith("all."):
29 yield file_path.replace("\\", "/")
30
31
32# Try to find coffeescript compiler in path

Callers 1

mergeFunction · 0.85

Calls 1

walkMethod · 0.45

Tested by

no test coverage detected