summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCaleb Bassi <calebjbassi@gmail.com>2018-12-27 15:35:05 -0800
committerCaleb Bassi <calebjbassi@gmail.com>2019-01-24 11:57:00 -0800
commita807090fd7d3b21b26d05baf962b6d6a0d615f92 (patch)
treef47c7ddd88dcbb444bc3cef6bc66db3da1d4d50c
parent7f20f31379eec35b97c138186d11d0265c9429f3 (diff)
downloadranger-a807090fd7d3b21b26d05baf962b6d6a0d615f92.tar.gz
Load plugin directories located in ~/.config/ranger/plugins
-rw-r--r--ranger/core/main.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/ranger/core/main.py b/ranger/core/main.py
index 598ce243..80007457 100644
--- a/ranger/core/main.py
+++ b/ranger/core/main.py
@@ -407,8 +407,15 @@ def load_settings(  # pylint: disable=too-many-locals,too-many-branches,too-many
         except OSError:
             LOG.debug('Unable to access plugin directory: %s', plugindir)
         else:
-            plugins = [p[:-3] for p in plugin_files
-                       if p.endswith('.py') and not p.startswith('_')]
+            plugins = []
+            for path in plugin_files:
+                if not path.startswith('_'):
+                    if path.endswith('.py'):
+                        # remove trailing '.py'
+                        plugins.append(path[:-3])
+                    elif os.path.isdir(os.path.join(plugindir, path)):
+                        plugins.append(path)
+
             if not os.path.exists(fm.confpath('plugins', '__init__.py')):
                 LOG.debug("Creating missing '__init__.py' file in plugin folder")
                 fobj = open(fm.confpath('plugins', '__init__.py'), 'w')
ref='#n6'>6 7 8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26