Module: deluge
Branch: 1.3-stable
Commit: 532973c3d160b1f1244122699a1a6ff21f4a0e08

Author: Calum Lind <[email protected]>
Date:   Mon May 30 12:48:23 2011 +0100

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

---

 deluge/common.py |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/deluge/common.py b/deluge/common.py
index d24de40..3328873 100644
--- a/deluge/common.py
+++ b/deluge/common.py
@@ -145,10 +145,17 @@ def get_default_config_dir(filename=None):
 
     """
     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:
-            return os.path.join(os.environ.get("APPDATA"), "deluge", filename)
+            return os.path.join(appDataPath, "deluge", filename)
         else:
-            return os.path.join(os.environ.get("APPDATA"), "deluge")
+            return os.path.join(appDataPath, "deluge")
     else:
         import xdg.BaseDirectory
         if filename:

-- 
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en.

Reply via email to