Fix #1504 - Win32 run deluged as not logged in user via runas or service

This commit is contained in:
Calum Lind 2011-05-30 12:48:23 +01:00
parent 254efa88e5
commit 532973c3d1
1 changed files with 9 additions and 2 deletions

View File

@ -145,10 +145,17 @@ def get_default_config_dir(filename=None):
""" """
if windows_check(): if windows_check():
appDataPath = os.environ.get("APPDATA")
if not appDataPath:
import _winreg
hkey = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders")
appDataReg = _winreg.QueryValueEx(hkey, "AppData")
appDataPath = appDataReg[0]
_winreg.CloseKey(hkey)
if filename: if filename:
return os.path.join(os.environ.get("APPDATA"), "deluge", filename) return os.path.join(appDataPath, "deluge", filename)
else: else:
return os.path.join(os.environ.get("APPDATA"), "deluge") return os.path.join(appDataPath, "deluge")
else: else:
import xdg.BaseDirectory import xdg.BaseDirectory
if filename: if filename: