summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDieter Verfaillie <dieterv@optionexplicit.be>2015-04-19 20:27:41 +0200
committerDieter Verfaillie <dieterv@optionexplicit.be>2015-06-20 00:32:16 +0200
commit047244537c8ad5725cc3f8e4f9ea0d5e226fe7e0 (patch)
treefbf68b32e5965b20a2167aaa4d1415bdcae76819
parent254ac953c6b18a0d4e93781cd9c29bf3dcd4953a (diff)
downloadgobject-introspection-047244537c8ad5725cc3f8e4f9ea0d5e226fe7e0.tar.gz
scanner: honor XDG_CACHE_HOME
We already use XDG_DATA_DIRS for .gir files lookup so we might as well honor XDG_CACHE_HOME instead of hardcoding ~/.cache. https://bugzilla.gnome.org/show_bug.cgi?id=747770
-rw-r--r--giscanner/cachestore.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/giscanner/cachestore.py b/giscanner/cachestore.py
index 0dbf1fb8..351bac38 100644
--- a/giscanner/cachestore.py
+++ b/giscanner/cachestore.py
@@ -45,6 +45,11 @@ def _get_versionhash():
def _get_cachedir():
if 'GI_SCANNER_DISABLE_CACHE' in os.environ:
return None
+
+ xdg_cache_home = os.environ.get('XDG_CACHE_HOME')
+ if xdg_cache_home is not None and os.path.exists(xdg_cache_home):
+ return xdg_cache_home
+
homedir = os.path.expanduser('~')
if homedir is None:
return None