diff options
author | mathieui <mathieui@mathieui.net> | 2013-03-03 00:24:18 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2013-03-03 00:24:18 +0100 |
commit | e861290d102c4fb11157898c8bf4b098b6c002fd (patch) | |
tree | bab62cd19247899f755ab8076639fa8fb00660f0 /src/plugin_manager.py | |
parent | 98850ff87700097c87364ca5b331e820bb20c2d8 (diff) | |
download | poezio-e861290d102c4fb11157898c8bf4b098b6c002fd.tar.gz poezio-e861290d102c4fb11157898c8bf4b098b6c002fd.tar.bz2 poezio-e861290d102c4fb11157898c8bf4b098b6c002fd.tar.xz poezio-e861290d102c4fb11157898c8bf4b098b6c002fd.zip |
Add a plugins_conf_dir option
Diffstat (limited to 'src/plugin_manager.py')
-rw-r--r-- | src/plugin_manager.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/plugin_manager.py b/src/plugin_manager.py index 5f848ec2..a8c651e9 100644 --- a/src/plugin_manager.py +++ b/src/plugin_manager.py @@ -25,10 +25,13 @@ plugins_dir = plugins_dir or\ 'poezio', 'plugins') plugins_dir = os.path.expanduser(plugins_dir) -config_home = os.environ.get("XDG_CONFIG_HOME") -if not config_home: - config_home = os.path.join(os.environ.get('HOME'), '.config') -plugins_conf_dir = os.path.join(config_home, 'poezio', 'plugins') +plugins_conf_dir = config.get('plugins_conf_dir', '') +if not plugins_conf_dir: + config_home = os.environ.get('XDG_CONFIG_HOME') + if not config_home: + config_home = os.path.join(os.environ.get('HOME'), '.config') + plugins_conf_dir = os.path.join(config_home, 'poezio', 'plugins') +plugins_conf_dir = os.path.expanduser(plugins_conf_dir) try: os.makedirs(plugins_dir) @@ -39,6 +42,7 @@ try: os.makedirs(plugins_conf_dir) except OSError: pass + default_plugin_path = path.join(path.dirname(path.dirname(__file__)), 'plugins') sys.path.append(default_plugin_path) @@ -283,3 +287,7 @@ class PluginManager(object): sys.path.remove(plugins_dir) sys.path.append(new_value) plugins_dir = new_value + + def on_plugins_conf_dir_change(self, new_value): + global plugins_conf_dir + plugins_conf_dir = new_value |