summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChun-wei Fan <fanchunwei@src.gnome.org>2014-07-03 17:27:41 +0800
committerChun-wei Fan <fanchunwei@src.gnome.org>2014-07-04 13:07:26 +0800
commit011b7c4496404d60a5b62bbe7de262e37509c5fb (patch)
tree3f02df58fed0adb913d80695e6ba7abf750b4e0d
parentffb96e681476f693b5027790c69f7b9e3628f0b7 (diff)
downloadgobject-introspection-011b7c4496404d60a5b62bbe7de262e37509c5fb.tar.gz
giscanner: Make _get_cachedir() Always Work on Windows
On Windows, checking for $(HOME) will work in a MSYS shell but not in cmd.exe (i.e. Visual Studio command prompt), so we need to check for HOMEPATH when we are building under a Visual Studio command prompt to get the users's home directory correctly. This will enable g-ir-doc-tool to work on Windows when run from cmd.exe. https://bugzilla.gnome.org/show_bug.cgi?id=732668
-rw-r--r--giscanner/cachestore.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/giscanner/cachestore.py b/giscanner/cachestore.py
index 3d8e6fd6..bcac0784 100644
--- a/giscanner/cachestore.py
+++ b/giscanner/cachestore.py
@@ -45,7 +45,10 @@ def _get_versionhash():
def _get_cachedir():
if 'GI_SCANNER_DISABLE_CACHE' in os.environ:
return None
- homedir = os.environ.get('HOME')
+ if os.name == 'nt' and 'MSYSTEM' not in os.environ:
+ homedir = os.environ.get('HOMEPATH')
+ else:
+ homedir = os.environ.get('HOME')
if homedir is None:
return None
if not os.path.exists(homedir):