summaryrefslogtreecommitdiffstats
path: root/module/InitHomeDir.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-08-13 15:59:34 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-08-13 15:59:34 +0200
commit77c966fef13ba1466705b584e2a55468d274960d (patch)
tree06981e69516c4eab0a035da326b1f396e1966d4f /module/InitHomeDir.py
parentimport fix (diff)
downloadpyload-77c966fef13ba1466705b584e2a55468d274960d.tar.xz
added simple update manager
Diffstat (limited to 'module/InitHomeDir.py')
-rw-r--r--module/InitHomeDir.py21
1 files changed, 10 insertions, 11 deletions
diff --git a/module/InitHomeDir.py b/module/InitHomeDir.py
index a3fc64e50..d7f98180a 100644
--- a/module/InitHomeDir.py
+++ b/module/InitHomeDir.py
@@ -31,24 +31,23 @@ __builtin__.pypath = path.abspath(path.join(__file__,"..",".."))
homedir = ""
-try:
- from win32com.shell import shellcon, shell
- homedir = shell.SHGetFolderPath(0, shellcon.CSIDL_APPDATA, 0, 0)
-except ImportError: # quick semi-nasty fallback for non-windows/win32com case
- if platform == 'nt':
+
+if platform == 'nt':
+ homedir = path.expanduser("~")
+ if homedir == "~":
import ctypes
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]
-
+ 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)
homedir = path_buf.value
- else:
- homedir = path.expanduser("~")
+else:
+ homedir = path.expanduser("~")
__builtin__.homedir = homedir