From 8d8c8a7f4e48b4bd60f65023ded49cb9883b3de9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Sun, 7 Feb 2010 17:52:15 +0100 Subject: [PATCH] look at environment variables by hand if PyXDG isn't available. see #2149 --- src/common/configpaths.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/common/configpaths.py b/src/common/configpaths.py index 33c118280..ba002bed7 100644 --- a/src/common/configpaths.py +++ b/src/common/configpaths.py @@ -103,9 +103,13 @@ class ConfigPaths: self.data_root = os.path.join(xdg.BaseDirectory.\ xdg_data_dirs[0], u'gajim') else: - self.config_root = os.path.expanduser(u'~/.config/gajim') - self.cache_root = os.path.expanduser(u'~/.cache/gajim') - self.data_root = os.path.expanduser(u'~/.local/share/gajim') + expand = os.path.expanduser + base = os.getenv('XDG_CONFIG_HOME') or expand(u'~/.config') + self.config_root = os.path.join(base, u'gajim') + base = os.getenv('XDG_CACHE_HOME') or expand(u'~/.cache') + self.cache_root = os.path.join(base, u'gajim') + base = os.getenv('XDG_DATA_HOME') or expand(u'~/.local/share') + self.data_root = os.path.join(base, u'gajim') def add(self, name, type_, path): self.paths[name] = (type_, path)