From 5aaa9aab715fbbdfc827e4b01612a999ebc09e23 Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Sun, 13 Aug 2023 14:18:39 +0100 Subject: [PATCH] '\\' join path parts --- voicemeeterlib/inst.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/voicemeeterlib/inst.py b/voicemeeterlib/inst.py index 1673c53..d54975e 100644 --- a/voicemeeterlib/inst.py +++ b/voicemeeterlib/inst.py @@ -12,27 +12,32 @@ if platform.system() != "Windows": VM_KEY = "VB:Voicemeeter {17359A74-1236-5467}" -REG_KEY = "".join( - [ - "SOFTWARE", - ("\\WOW6432Node" if bits == 64 else ""), - "\\Microsoft\\Windows\\CurrentVersion\\Uninstall", - ] +REG_KEY = "\\".join( + filter( + None, + ( + "SOFTWARE", + "WOW6432Node" if bits == 64 else "", + "Microsoft", + "Windows", + "CurrentVersion", + "Uninstall", + ), + ) ) def get_vmpath(): with winreg.OpenKey( - winreg.HKEY_LOCAL_MACHINE, r"{}".format(REG_KEY + "\\" + VM_KEY) + winreg.HKEY_LOCAL_MACHINE, r"{}".format("\\".join((REG_KEY, VM_KEY))) ) as vm_key: return winreg.QueryValueEx(vm_key, r"UninstallString")[0] try: - vm_path = Path(get_vmpath()) + vm_parent = Path(get_vmpath()).parent except FileNotFoundError as e: raise InstallError(f"Unable to fetch DLL path from the registry") from e -vm_parent = vm_path.parent DLL_NAME = f'VoicemeeterRemote{"64" if bits == 64 else ""}.dll'