diff options
-rw-r--r-- | ranger/container/settings.py | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/ranger/container/settings.py b/ranger/container/settings.py index 71f3e601..75d74fd6 100644 --- a/ranger/container/settings.py +++ b/ranger/container/settings.py @@ -6,7 +6,7 @@ from ranger.ext.signals import SignalDispatcher, Signal from ranger.core.shared import FileManagerAware from ranger.gui.colorscheme import _colorscheme_name_to_class import re -import os +import os.path ALLOWED_SETTINGS = { 'autosave_bookmarks': bool, @@ -122,19 +122,23 @@ class Settings(SignalDispatcher, FileManagerAware): def get(self, name, path=None): assert name in ALLOWED_SETTINGS, "No such setting: {0}!".format(name) - if not path: + if path: + localpath = path + else: try: - path = self.fm.thisdir.path + localpath = self.fm.thisdir.path except: - pass - if path: + localpath = path + + if localpath: for pattern, regex in self._localregexes.items(): if name in self._localsettings[pattern] and\ - regex.search(path): + regex.search(localpath): return self._localsettings[pattern][name] if self._tagsettings and path: - if self.fm.thisdir.realpath in self.fm.tags: - tag = self.fm.tags.marker(self.fm.thisdir.realpath) + realpath = os.path.realpath(path) + if realpath in self.fm.tags: + tag = self.fm.tags.marker(realpath) if tag in self._tagsettings and name in self._tagsettings[tag]: return self._tagsettings[tag][name] if name in self._settings: |