Using os.path.expanduser on windows to figure out where to put config file.
This commit is contained in:
parent
089e11c578
commit
1ad3e94129
1 changed files with 6 additions and 5 deletions
|
|
@ -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')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue