diff options
author | mkaay <mkaay@mkaay.de> | 2010-05-07 21:03:44 +0200 |
---|---|---|
committer | mkaay <mkaay@mkaay.de> | 2010-05-07 21:03:44 +0200 |
commit | 2dc40f269d126b01f3e46a5e25a427b26b4cd2ba (patch) | |
tree | 4c3951aec77972d3d2565bd38cd10aa8e8195049 /pyLoadCore.py | |
parent | better plugin import (diff) | |
download | pyload-2dc40f269d126b01f3e46a5e25a427b26b4cd2ba.tar.xz |
windows fix
Diffstat (limited to 'pyLoadCore.py')
-rwxr-xr-x | pyLoadCore.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/pyLoadCore.py b/pyLoadCore.py index 259f8fbe0..906f59cae 100755 --- a/pyLoadCore.py +++ b/pyLoadCore.py @@ -513,7 +513,21 @@ class Core(object): from win32com.shell import shellcon, shell return shell.SHGetFolderPath(0, shellcon.CSIDL_APPDATA, 0, 0) except ImportError: # quick semi-nasty fallback for non-windows/win32com case - return expanduser("~") + if platform == 'nt': + import ctypes + from ctypes import wintypes, windll + CSIDL_APPDATA = 26 + _SHGetFolderPath = ctypes.windll.shell32.SHGetFolderPathW + _SHGetFolderPath.argtypes = [ctypes.wintypes.HWND, + ctypes.c_int, + ctypes.wintypes.HANDLE, + ctypes.wintypes.DWORD, ctypes.wintypes.LPCWSTR] + + path_buf = ctypes.wintypes.create_unicode_buffer(ctypes.wintypes.MAX_PATH) + result = _SHGetFolderPath(0, CSIDL_APPDATA, 0, 0, path_buf) + return path_buf.value + else: + return expanduser("~") #################################### ########## XMLRPC Methods ########## |