diff options
author | Kali Kaneko <kali@leap.se> | 2016-09-20 17:04:39 -0400 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2016-09-20 17:04:39 -0400 |
commit | 73f71ff59fa0787ea661b7d0c11ffa0261609d49 (patch) | |
tree | b797e35d348af9cf577869f5e67ef1fc78ff22e2 /src/leap/common/config/__init__.py | |
parent | e05d61b662d0750f85579b74f033d5c4245ed92f (diff) | |
parent | 8e74ba115f32bdd56a212a4015b836c4ddd7a57a (diff) |
Merge tag '0.5.2' into debian/experimental
0.5.2
Diffstat (limited to 'src/leap/common/config/__init__.py')
-rw-r--r-- | src/leap/common/config/__init__.py | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/leap/common/config/__init__.py b/src/leap/common/config/__init__.py index 68d92dc..15c6fea 100644 --- a/src/leap/common/config/__init__.py +++ b/src/leap/common/config/__init__.py @@ -18,8 +18,22 @@ Common configs """ import os +import sys -from dirspec.basedir import get_xdg_config_home + +def _get_xdg_config_home(): + if sys.platform == 'win32': + from win32com.shell import shell, shellcon + get_path = lambda name: shell.SHGetFolderPath( + 0, getattr(shellcon, name), None, 0).encode('utf8') + path = get_path('CSIDL_LOCAL_APPDATA') + elif sys.platform == 'darwin': + user_home = os.path.expanduser('~') + path = os.path.join(user_home, 'Library', 'Preferences') + else: + user_home = os.path.expanduser('~') + path = os.path.join(user_home, '.config') + return path def get_path_prefix(standalone=False): @@ -32,8 +46,6 @@ def get_path_prefix(standalone=False): configuration storage. :type standalone: bool """ - config_home = get_xdg_config_home() if standalone: - config_home = os.path.join(os.getcwd(), "config") - - return config_home + return os.path.join(os.getcwd(), "config") + return _get_xdg_config_home() |