diff options
author | hut <hut@lavabit.com> | 2012-08-02 03:15:19 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2012-08-02 03:19:33 +0200 |
commit | 71598234b87dc0a2930a495764e1316ecec83754 (patch) | |
tree | d3085cc252cdb453a8b9e7fbf6d2c56fe6c9e1d6 /ranger | |
parent | e5978d9ed9ffb3382e23a56c9f8f03544109b2aa (diff) | |
download | ranger-71598234b87dc0a2930a495764e1316ecec83754.tar.gz |
defaults.options: type of hidden_filter changed from regexp to string
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/defaults/options.py | 3 | ||||
-rw-r--r-- | ranger/fsobject/directory.py | 14 |
2 files changed, 13 insertions, 4 deletions
diff --git a/ranger/defaults/options.py b/ranger/defaults/options.py index 5e30f042..c2d1fe57 100644 --- a/ranger/defaults/options.py +++ b/ranger/defaults/options.py @@ -25,8 +25,7 @@ column_ratios = (1, 3, 4) # Which files should be hidden? Toggle this by typing `zh' or # changing the setting `show_hidden' -hidden_filter = regexp( - r'^\.|\.(?:pyc|pyo|bak|swp)$|^lost\+found$|^__(py)?cache__$') +hidden_filter = r'^\.|\.(?:pyc|pyo|bak|swp)$|^lost\+found$|^__(py)?cache__$' show_hidden = False # Which script is used to generate file previews? diff --git a/ranger/fsobject/directory.py b/ranger/fsobject/directory.py index 1abd6ddd..e6909fbb 100644 --- a/ranger/fsobject/directory.py +++ b/ranger/fsobject/directory.py @@ -2,6 +2,7 @@ # This software is distributed under the terms of the GNU GPL version 3. import os.path +import re from os import stat as os_stat, lstat as os_lstat from collections import deque from time import time @@ -173,8 +174,17 @@ class Directory(FileSystemObject, Accumulator, Loadable, SettingsAware): self.mount_path = mount_path(mypath) - hidden_filter = not self.settings.show_hidden \ - and self.settings.hidden_filter + if not self.settings.show_hidden and self.settings.hidden_filter: + # COMPAT + # hidden_filter used to be a regex, not a string. If an + # old config is used, we don't need to re.compile it. + if hasattr(self.settings.hidden_filter, 'search'): + hidden_filter = self.settings.hidden_filter + else: + hidden_filter = re.compile(self.settings.hidden_filter) + else: + hidden_filter = None + filelist = os.listdir(mypath) if self._cumulative_size_calculated: |