From 1ad3e9412908ddc1e8d8ab79aa60a848071f9151 Mon Sep 17 00:00:00 2001 From: John G Evans Date: Fri, 26 Jul 2013 14:32:53 -0400 Subject: [PATCH] Using os.path.expanduser on windows to figure out where to put config file. --- glymur/lib/config.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/glymur/lib/config.py b/glymur/lib/config.py index 7fcaeb6..21c1205 100644 --- a/glymur/lib/config.py +++ b/glymur/lib/config.py @@ -143,10 +143,11 @@ def get_configdir(): if 'XDG_CONFIG_HOME' in os.environ: return os.path.join(os.environ['XDG_CONFIG_HOME'], 'glymur') - if 'HOME' in os.environ: + if 'HOME' in os.environ and os.name != 'nt': + # HOME is set by WinPython to something unusual, so we don't + # want that. return os.path.join(os.environ['HOME'], '.config', 'glymur') - if 'USERPROFILE' in os.environ: - # Windows? - return os.path.join(os.environ['USERPROFILE'], 'Application Data', - 'glymur') + if os.name == 'nt': + # Windows. + return os.path.join(os.path.expanduser('~'), 'glymur')