[gobject-introspection] scanner: honor XDG_CACHE_HOME



commit 047244537c8ad5725cc3f8e4f9ea0d5e226fe7e0
Author: Dieter Verfaillie <dieterv optionexplicit be>
Date:   Sun Apr 19 20:27:41 2015 +0200

    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

 giscanner/cachestore.py |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/giscanner/cachestore.py b/giscanner/cachestore.py
index 0dbf1fb..351bac3 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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]