From a807090fd7d3b21b26d05baf962b6d6a0d615f92 Mon Sep 17 00:00:00 2001 From: Caleb Bassi Date: Thu, 27 Dec 2018 15:35:05 -0800 Subject: Load plugin directories located in ~/.config/ranger/plugins --- ranger/core/main.py | 11 +++++++++-- 1 file 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') -- cgit 1.4.1-2-gfad0