From 011b7c4496404d60a5b62bbe7de262e37509c5fb Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Thu, 3 Jul 2014 17:27:41 +0800 Subject: 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 --- giscanner/cachestore.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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): -- cgit v1.2.1