mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-24 08:41:16 +00:00
15 lines
441 B
Python
15 lines
441 B
Python
import os
|
|
import sys
|
|
|
|
if sys.version_info.major > 2:
|
|
from typing import Callable
|
|
|
|
|
|
def iterate_dir(path, file_callback): # type: (str, Callable[[str], None]) -> None
|
|
for file_or_dir_name in os.listdir(path): # pathlib not supported
|
|
child_path = os.path.join(path, file_or_dir_name)
|
|
if os.path.isdir(child_path):
|
|
iterate_dir(child_path, file_callback)
|
|
else:
|
|
file_callback(child_path)
|