From a69031015b4b5a2f451a1d5cf24a4dda7196364f Mon Sep 17 00:00:00 2001 From: "R. Richard" Date: Mon, 20 May 2019 14:50:02 +0200 Subject: [PATCH] Refactor file manager --- .../components/{ => ide_event_handler}/ide_event_handler.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) rename lib/tfw/components/{ => ide_event_handler}/ide_event_handler.py (98%) diff --git a/lib/tfw/components/ide_event_handler.py b/lib/tfw/components/ide_event_handler/ide_event_handler.py similarity index 98% rename from lib/tfw/components/ide_event_handler.py rename to lib/tfw/components/ide_event_handler/ide_event_handler.py index da32cda..19d8652 100644 --- a/lib/tfw/components/ide_event_handler.py +++ b/lib/tfw/components/ide_event_handler/ide_event_handler.py @@ -16,7 +16,7 @@ LOG = logging.getLogger(__name__) class FileManager: # pylint: disable=too-many-instance-attributes def __init__(self, working_directory, allowed_directories, selected_file=None, exclude=None): - self._exclude, self.exclude = None, exclude + self._exclude, self.exclude = [], exclude self._allowed_directories, self.allowed_directories = None, allowed_directories self._workdir, self.workdir = None, working_directory self._filename, self.filename = None, selected_file or self.files[0] @@ -91,7 +91,8 @@ class FileManager: # pylint: disable=too-many-instance-attributes def _is_blacklisted(self, file): return any( - fnmatchcase(file, blacklisted) + fnmatchcase(file, blacklisted) or + fnmatchcase(basename(file), blacklisted) for blacklisted in self.exclude )