[GTKUI] [Win32] Fix 'access is denied' with magnet association
* Issue occurs with user without administrator privileges * See github pull request #19 for details
This commit is contained in:
parent
aede6f9ce5
commit
dd8d2c8557
|
@ -172,7 +172,12 @@ def associate_magnet_links(overwrite=False):
|
||||||
|
|
||||||
if overwrite:
|
if overwrite:
|
||||||
deluge_exe = os.path.join(os.path.dirname(sys.executable), "deluge.exe")
|
deluge_exe = os.path.join(os.path.dirname(sys.executable), "deluge.exe")
|
||||||
magnet_key = _winreg.CreateKey(_winreg.HKEY_CLASSES_ROOT, "Magnet")
|
try:
|
||||||
|
magnet_key = _winreg.CreateKey(_winreg.HKEY_CLASSES_ROOT, "Magnet")
|
||||||
|
except WindowsError:
|
||||||
|
# Could not create for all users, falling back to current user
|
||||||
|
magnet_key = _winreg.CreateKey(_winreg.HKEY_CURRENT_USER, "Software\\Classes\\Magnet")
|
||||||
|
|
||||||
_winreg.SetValue(magnet_key, "", _winreg.REG_SZ, "URL:Magnet Protocol")
|
_winreg.SetValue(magnet_key, "", _winreg.REG_SZ, "URL:Magnet Protocol")
|
||||||
_winreg.SetValueEx(magnet_key, "URL Protocol", 0, _winreg.REG_SZ, "")
|
_winreg.SetValueEx(magnet_key, "URL Protocol", 0, _winreg.REG_SZ, "")
|
||||||
_winreg.SetValueEx(magnet_key, "BrowserFlags", 0, _winreg.REG_DWORD, 0x8)
|
_winreg.SetValueEx(magnet_key, "BrowserFlags", 0, _winreg.REG_DWORD, 0x8)
|
||||||
|
|
Loading…
Reference in New Issue