From 337b0d3286142105c4072d9978d668f0924f7ebe Mon Sep 17 00:00:00 2001 From: David Aguilar Date: Sat, 19 Oct 2013 01:43:04 -0700 Subject: [PATCH] xdg: move `cola.xdg.config_home()` to `cola.resources` Signed-off-by: David Aguilar --- cola/i18n.py | 3 +-- cola/resources.py | 7 +++++++ cola/settings.py | 4 ++-- cola/xdg.py | 11 ----------- 4 files changed, 10 insertions(+), 15 deletions(-) delete mode 100644 cola/xdg.py diff --git a/cola/i18n.py b/cola/i18n.py index 38c758ee..76e58318 100644 --- a/cola/i18n.py +++ b/cola/i18n.py @@ -7,7 +7,6 @@ import sys from cola import compat from cola import core from cola import resources -from cola import xdg _null_translation = _gettext.NullTranslations() _translation = _null_translation @@ -52,7 +51,7 @@ def _get_locale_dir(): def _install_custom_language(): """Allow a custom language to be set in ~/.config/git-cola/language""" - lang_file = xdg.config_home('language') + lang_file = resources.config_home('language') if not core.exists(lang_file): return try: diff --git a/cola/resources.py b/cola/resources.py index 6621f5f6..0194b478 100644 --- a/cola/resources.py +++ b/cola/resources.py @@ -5,6 +5,7 @@ from os.path import dirname from cola import core + _modpath = core.abspath(__file__) if os.path.join('share', 'git-cola', 'lib') in _modpath: # this is the release tree @@ -54,3 +55,9 @@ def icon(basename): def icon_dir(): """Return the path to the style dir within the cola install tree.""" return share('icons') + + +def config_home(*args): + config = core.getenv('XDG_CONFIG_HOME', + os.path.join(core.expanduser('~'), '.config')) + return os.path.join(config, 'git-cola', *args) diff --git a/cola/settings.py b/cola/settings.py index 9b8311be..50d8ba6e 100644 --- a/cola/settings.py +++ b/cola/settings.py @@ -7,7 +7,7 @@ import sys from cola import core from cola import git -from cola import xdg +from cola import resources from cola.compat import json @@ -26,7 +26,7 @@ def mklist(obj): class Settings(object): - _file = xdg.config_home('settings') + _file = resources.config_home('settings') def __init__(self, verify=git.is_git_worktree): """Load existing settings if they exist""" diff --git a/cola/xdg.py b/cola/xdg.py deleted file mode 100644 index 93191f63..00000000 --- a/cola/xdg.py +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright (c) 2012 David Aguilar -"""XDG user dirs -""" -import os -from cola import core - - -def config_home(*args): - config = core.getenv('XDG_CONFIG_HOME', - os.path.join(core.expanduser('~'), '.config')) - return os.path.join(config, 'git-cola', *args) -- 2.11.4.GIT