Use realpath when comparing paths

This commit is contained in:
Corantin H 2024-01-07 13:21:02 +01:00
parent fda996014b
commit 2e1d44dc23

View file

@ -17,11 +17,19 @@ IGNORE_FILES = [
"src/engine/client/keynames.h", "src/engine/client/keynames.h",
"src/engine/keys.h", "src/engine/keys.h",
] ]
IGNORE_DIRS = [
"src/game/generated",
"src/rust-bridge"
]
def filter_ignored(filenames): def filter_ignored(filenames):
return [filename for filename in filenames result = []
if filename not in IGNORE_FILES for filename in filenames:
and not filename.startswith("src/game/generated/") real_filename = os.path.realpath(filename)
and not filename.startswith("src/rust-bridge")] if real_filename not in [os.path.realpath(ignore_file) for ignore_file in IGNORE_FILES] \
and not any(real_filename.startswith(os.path.realpath(subdir) + os.path.sep) for subdir in IGNORE_DIRS):
result.append(filename)
return result
def filter_cpp(filenames): def filter_cpp(filenames):
return [filename for filename in filenames return [filename for filename in filenames