From 05e4de37f8d43117de8110a02844763c6375b09f Mon Sep 17 00:00:00 2001 From: max-torch <41433185+max-torch@users.noreply.github.com> Date: Mon, 1 Nov 2021 01:52:09 +0800 Subject: [PATCH] Update wmltools3.py --- data/tools/wesnoth/wmltools3.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/data/tools/wesnoth/wmltools3.py b/data/tools/wesnoth/wmltools3.py index b0a3424f8d68..cdb426a67315 100644 --- a/data/tools/wesnoth/wmltools3.py +++ b/data/tools/wesnoth/wmltools3.py @@ -14,6 +14,7 @@ image_extensions = ("png", "jpg", "jpeg") sound_extensions = ("ogg", "wav") vc_directories = (".git", ".svn") +misc_files_extensions = ("-bak", ".DS_Store", "Thumbs.db") l10n_directories = ("l10n",) resource_extensions = map_extensions + image_extensions + sound_extensions image_reference = r"[A-Za-z0-9{}.][A-Za-z0-9_/+{}.\-\[\]~\*,]*\.(png|jpe?g)(?=(~.*)?)" @@ -225,15 +226,15 @@ def __init__(self, dirpath, exclude=None): subtree = sorted(maincfgs) + sorted(rest) self.forest.append(subtree) for i in range(len(self.forest)): - # Ignore version-control subdirectories, Emacs tempfiles, and Apple Store files + # Ignore version-control subdirectories, Emacs tempfiles, and other files and extensions for dirkind in vc_directories + l10n_directories: self.forest[i] = [x for x in self.forest[i] if dirkind not in x] self.forest[i] = [x for x in self.forest[i] if '.#' not in x] self.forest[i] = [x for x in self.forest[i] if not os.path.isdir(x)] if exclude: self.forest[i] = [x for x in self.forest[i] if not re.search(exclude, x)] - self.forest[i] = [x for x in self.forest[i] if not x.endswith("-bak")] - self.forest[i] = [x for x in self.forest[i] if not x.endswith(".DS_Store")] + for each in misc_files_extensions: + self.forest[i] = [x for x in self.forest[i] if not x.endswith(each)] # Compute cliques (will be used later for visibility checks) self.clique = {} counter = 0