changeset 519b84cdeecd in tryton:default
details: https://hg.tryton.org/tryton?cmd=changeset&node=519b84cdeecd
description:
        Do not fail on missing HOME environment to get config directory

        Also use first the XDG_CONFIG_HOME and fallback to expanduser.
diffstat:

 tryton/config.py |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (15 lines):

diff -r 6f99b844d718 -r 519b84cdeecd tryton/config.py
--- a/tryton/config.py  Sun Apr 17 00:52:58 2022 +0200
+++ b/tryton/config.py  Mon Apr 18 19:32:26 2022 +0200
@@ -22,8 +22,9 @@
             appdata = str(appdata, sys.getfilesystemencoding())
         return os.path.join(appdata, '.config', 'tryton',
                 __version__.rsplit('.', 1)[0])
-    return os.path.join(os.environ['HOME'], '.config', 'tryton',
-            __version__.rsplit('.', 1)[0])
+    config_path = os.getenv('XDG_CONFIG_HOME', os.path.join('~', '.config'))
+    return os.path.expanduser(
+        os.path.join(config_path, 'tryton', __version__.rsplit('.', 1)[0]))
 
 
 if not os.path.isdir(get_config_dir()):

Reply via email to