voicemeeter-rb/lib/voicemeeter/install.rb

34 lines
654 B
Ruby
Raw Normal View History

2023-07-07 02:30:05 +01:00
require "win32/registry"
require "pathname"
require "ffi"
module Voicemeeter
private
module Install
2023-07-14 12:01:41 +01:00
OS_BITS = (FFI::Platform::CPU.downcase == "x64") ? 64 : 32
2023-07-07 02:30:05 +01:00
2023-07-14 12:01:41 +01:00
def get_vmpath
2023-07-07 02:30:05 +01:00
reg_key = [
:Software,
2023-07-14 12:01:41 +01:00
((OS_BITS == 64) ? :WOW6432Node : nil),
2023-07-07 02:30:05 +01:00
:Microsoft,
:Windows,
:CurrentVersion,
:Uninstall,
2023-07-14 12:01:41 +01:00
:"VB:Voicemeeter {17359A74-1236-5467}"
2023-07-07 02:30:05 +01:00
]
Win32::Registry::HKEY_LOCAL_MACHINE.open(
reg_key.compact.join("\\")
) do |reg|
value = reg[:UninstallString.to_s]
Pathname.new(value).dirname
end
end
module_function :get_vmpath
end
end