Python script for win registry
This commit is contained in:
parent
735e9195b5
commit
d3807cb86c
2 changed files with 35 additions and 1 deletions
|
@ -5,7 +5,7 @@ Windows Registry Editor Version 5.00
|
||||||
"URL Protocol"=""
|
"URL Protocol"=""
|
||||||
|
|
||||||
[HKEY_CLASSES_ROOT\lbry\DefaultIcon]
|
[HKEY_CLASSES_ROOT\lbry\DefaultIcon]
|
||||||
@="LBRY.exe,1"
|
@="\"LBRY.exe,1\""
|
||||||
|
|
||||||
[HKEY_CLASSES_ROOT\lbry\shell]
|
[HKEY_CLASSES_ROOT\lbry\shell]
|
||||||
|
|
||||||
|
|
34
packaging/windows/lbry-win32-app/LBRYURIRegistry.py
Normal file
34
packaging/windows/lbry-win32-app/LBRYURIRegistry.py
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
import _winreg as winreg
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
lbry_path = os.path.join(os.environ["ProgramFiles"], "LBRY", "LBRY.exe")
|
||||||
|
|
||||||
|
key_url = 'lbry'
|
||||||
|
try:
|
||||||
|
key = winreg.OpenKey(winreg.HKEY_CLASSES_ROOT, key_url, 0, winreg.KEY_ALL_ACCESS)
|
||||||
|
except:
|
||||||
|
key = winreg.CreateKey(winreg.HKEY_CLASSES_ROOT, key_url)
|
||||||
|
winreg.SetValueEx(key, None, 0, winreg.REG_SZ, "URL:LBRY Protocol")
|
||||||
|
winreg.SetValueEx(key, "URL Protocol", 0, winreg.REG_SZ, "")
|
||||||
|
winreg.CloseKey(key)
|
||||||
|
|
||||||
|
key_icon = os.path.join('lbry', 'DefaultIcon')
|
||||||
|
try:
|
||||||
|
key = winreg.OpenKey(winreg.HKEY_CLASSES_ROOT, key_icon, 0, winreg.KEY_ALL_ACCESS)
|
||||||
|
except:
|
||||||
|
key = winreg.CreateKey(winreg.HKEY_CLASSES_ROOT, key_icon)
|
||||||
|
winreg.SetValueEx(key, None, 0, winreg.REG_SZ, "\"LBRY.exe,1\"")
|
||||||
|
winreg.CloseKey(key)
|
||||||
|
|
||||||
|
key_command = os.path.join('lbry', 'shell', 'open', 'command')
|
||||||
|
try:
|
||||||
|
key = winreg.OpenKey(winreg.HKEY_CLASSES_ROOT, key_command, 0, winreg.KEY_ALL_ACCESS)
|
||||||
|
except:
|
||||||
|
key = winreg.CreateKey(winreg.HKEY_CLASSES_ROOT, key_command)
|
||||||
|
winreg.SetValueEx(key, None, 0, winreg.REG_SZ, "\"{0}\" \"%1\"".format(lbry_path))
|
||||||
|
winreg.CloseKey(key)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
Loading…
Reference in a new issue