mirror of
https://github.com/onyx-and-iris/voicemeeter-api-python.git
synced 2024-11-22 11:00:47 +00:00
raise InstallError if reg key not found
This commit is contained in:
parent
155e597db5
commit
36fe77f0f0
@ -25,17 +25,19 @@ def get_vmpath():
|
|||||||
with winreg.OpenKey(
|
with winreg.OpenKey(
|
||||||
winreg.HKEY_LOCAL_MACHINE, r"{}".format(REG_KEY + "\\" + VM_KEY)
|
winreg.HKEY_LOCAL_MACHINE, r"{}".format(REG_KEY + "\\" + VM_KEY)
|
||||||
) as vm_key:
|
) as vm_key:
|
||||||
path = winreg.QueryValueEx(vm_key, r"UninstallString")[0]
|
return winreg.QueryValueEx(vm_key, r"UninstallString")[0]
|
||||||
return path
|
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
vm_path = Path(get_vmpath())
|
vm_path = Path(get_vmpath())
|
||||||
|
except FileNotFoundError as e:
|
||||||
|
raise InstallError(f"Unable to fetch DLL path from the registry") from e
|
||||||
vm_parent = vm_path.parent
|
vm_parent = vm_path.parent
|
||||||
|
|
||||||
DLL_NAME = f'VoicemeeterRemote{"64" if bits == 64 else ""}.dll'
|
DLL_NAME = f'VoicemeeterRemote{"64" if bits == 64 else ""}.dll'
|
||||||
|
|
||||||
dll_path = vm_parent.joinpath(DLL_NAME)
|
dll_path = vm_parent.joinpath(DLL_NAME)
|
||||||
if not dll_path.is_file():
|
if not dll_path.is_file():
|
||||||
raise InstallError(f"Could not find {DLL_NAME}")
|
raise InstallError(f"Could not find {dll_path}")
|
||||||
|
|
||||||
libc = ct.CDLL(str(dll_path))
|
libc = ct.CDLL(str(dll_path))
|
||||||
|
Loading…
Reference in New Issue
Block a user