changeset f1752fd85edf in /home/hg/repos/gajim
author: lovetox forenjunkie@chelo.at branches: gajim_0.16 details:http://hg.gajim.org/gajim?cmd=changeset;node=f1752fd85edf description: Remove unused xdg code and make it check for absolute paths
diffstat:
src/common/configpaths.py | 40 +++++++++++++--------------------------- 1 files changed, 13 insertions(+), 27 deletions(-)
diffs (57 lines):
diff -r 520a0a46bcf1 -r f1752fd85edf src/common/configpaths.py --- a/src/common/configpaths.py Sat Nov 05 18:23:03 2016 +0100 +++ b/src/common/configpaths.py Sat Nov 05 23:51:31 2016 +0100 @@ -26,11 +26,6 @@ import sys import tempfile import defs -HAVE_XDG = True -try: - __import__(xdg) -except: - HAVE_XDG = False
( TYPE_CONFIG, @@ -88,28 +83,19 @@ self.config_root = self.cache_root = self.data_root = u'.' else: # Unices # Pass in an Unicode string, and hopefully get one back. - if HAVE_XDG: - self.config_root = xdg.BaseDirectory.load_first_config('gajim') - if not self.config_root: - # Folder doesn't exist yet. - self.config_root = os.path.join(xdg.BaseDirectory.\ - xdg_config_dirs[0], u'gajim') - - self.cache_root = os.path.join(xdg.BaseDirectory.xdg_cache_home, - u'gajim') - - self.data_root = xdg.BaseDirectory.save_data_path('gajim') - if not self.data_root: - self.data_root = os.path.join(xdg.BaseDirectory.\ - xdg_data_dirs[0], u'gajim') - else: - 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') + expand = os.path.expanduser + base = os.getenv('XDG_CONFIG_HOME') + if base is None or base[0] != '/': + base = expand(u'~/.config') + self.config_root = os.path.join(base, u'gajim') + base = os.getenv('XDG_CACHE_HOME') + if base is None or base[0] != '/': + base = expand(u'~/.cache') + self.cache_root = os.path.join(base, u'gajim') + base = os.getenv('XDG_DATA_HOME') + if base is None or base[0] != '/': + base = expand(u'~/.local/share') + self.data_root = os.path.join(base, u'gajim')
def add(self, name, type_, path): self.paths[name] = (type_, path)