From e6c6a70a0c996bc36f1cc22ade1a1a78b645feb5 Mon Sep 17 00:00:00 2001 From: jrom99 <47498278+jrom99@users.noreply.github.com> Date: Wed, 27 Mar 2024 00:12:00 -0300 Subject: [PATCH] Fallback to previous directory if user already has plugins rc file --- modules/pymol/plugins/__init__.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/modules/pymol/plugins/__init__.py b/modules/pymol/plugins/__init__.py index f2b046056..2f8aa5b9e 100644 --- a/modules/pymol/plugins/__init__.py +++ b/modules/pymol/plugins/__init__.py @@ -20,10 +20,16 @@ def user_data_dir(appname, *args, **kwargs): return f"~/.local/share/{appname}" # variables -data_dir = os.path.expanduser(user_data_dir("pymol")) -if not os.path.exists(data_dir): +def _get_pymolplugins_rc_path(): + f1 = os.path.expanduser("~/.pymolpluginsrc.py") + if os.path.exists(f1): + return f1 + + data_dir = os.path.expanduser(user_data_dir("pymol")) os.makedirs(data_dir, exist_ok=True) -PYMOLPLUGINSRC = os.path.join(data_dir, 'pymolpluginsrc.py') + return os.path.join(data_dir, 'pymolpluginsrc.py') + +PYMOLPLUGINSRC = _get_pymolplugins_rc_path() preferences = { 'verbose': False,