File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,22 @@ def get_short_path_name(long_name):
53
53
output_buf_size = needed
54
54
55
55
56
+ # https://github.com/ActiveState/appdirs/blob/master/appdirs.py
57
+ def _get_win_appdata_from_registry ():
58
+ """This is a fallback technique at best. I'm not sure if using the
59
+ registry for this guarantees us the correct answer for all CSIDL_*
60
+ names.
61
+ """
62
+ import _winreg
63
+
64
+ key = _winreg .OpenKey (
65
+ _winreg .HKEY_CURRENT_USER ,
66
+ r"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"
67
+ )
68
+ dir , type = _winreg .QueryValueEx (key , "AppData" )
69
+ return dir
70
+
71
+
56
72
def lookupExeFolder ():
57
73
"""Returns executable folder path"""
58
74
if frozen :
@@ -88,8 +104,8 @@ def lookupAppdataFolder():
88
104
'Could not find home folder, please report this message'
89
105
' and your OS X version to the BitMessage Github.' )
90
106
elif sys .platform .startswith ('win' ):
91
- dataFolder = get_short_path_name (
92
- os . path . join ( os . environ [ 'APPDATA' ] , APPNAME ) + os .path .sep )
107
+ dataFolder = os . path . join (
108
+ _get_win_appdata_from_registry () , APPNAME ) + os .path .sep
93
109
else :
94
110
try :
95
111
dataFolder = os .path .join (os .environ ['XDG_CONFIG_HOME' ], APPNAME )
You can’t perform that action at this time.
0 commit comments