Using os.path.expanduser on windows to figure out where to put config file.

This commit is contained in:
John G Evans 2013-07-26 14:32:53 -04:00
commit 1ad3e94129

View file

@ -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')