diff options
-rw-r--r-- | examples/plugin_file_filter.py | 6 | ||||
-rw-r--r-- | ranger/fsobject/directory.py | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/examples/plugin_file_filter.py b/examples/plugin_file_filter.py index 99d026bb..39e4e285 100644 --- a/examples/plugin_file_filter.py +++ b/examples/plugin_file_filter.py @@ -6,11 +6,11 @@ import ranger.fsobject.directory old_accept_file = ranger.fsobject.directory.accept_file # Define a new one -def custom_accept_file(fname, mypath, hidden_filter, name_filter): - if hidden_filter and mypath == '/' and fname in ('boot', 'sbin', 'proc', 'sys'): +def custom_accept_file(fname, directory, hidden_filter, name_filter): + if hidden_filter and directory.path == '/' and fname in ('boot', 'sbin', 'proc', 'sys'): return False else: - return old_accept_file(fname, mypath, hidden_filter, name_filter) + return old_accept_file(fname, directory, hidden_filter, name_filter) # Overwrite the old function import ranger.fsobject.directory diff --git a/ranger/fsobject/directory.py b/ranger/fsobject/directory.py index d21c856d..a71b00a9 100644 --- a/ranger/fsobject/directory.py +++ b/ranger/fsobject/directory.py @@ -36,7 +36,7 @@ def sort_naturally(path): def sort_naturally_icase(path): return path.basename_natural_lower -def accept_file(fname, dirname, hidden_filter, name_filter): +def accept_file(fname, directory, hidden_filter, name_filter): if hidden_filter and hidden_filter.search(fname): return False if name_filter and name_filter not in fname: @@ -210,7 +210,7 @@ class Directory(FileSystemObject, Accumulator, Loadable, SettingsAware): filenames = [mypath + (mypath == '/' and fname or '/' + fname)\ for fname in filelist if accept_file( - fname, mypath, hidden_filter, self.filter)] + fname, self, hidden_filter, self.filter)] yield self.load_content_mtime = os.stat(mypath).st_mtime |