mirror of
https://github.com/onyx-and-iris/voicemeeter-rb.git
synced 2024-11-15 15:00:46 +00:00
log Registry error if unable to read vm path
then raise VMInstallError
This commit is contained in:
parent
e06b4eaf2b
commit
a0c722e722
@ -2,10 +2,15 @@ require "win32/registry"
|
|||||||
require "pathname"
|
require "pathname"
|
||||||
require "ffi"
|
require "ffi"
|
||||||
|
|
||||||
|
require_relative "logger"
|
||||||
|
require_relative "errors"
|
||||||
|
|
||||||
module Voicemeeter
|
module Voicemeeter
|
||||||
private
|
private
|
||||||
|
|
||||||
module Install
|
module Install
|
||||||
|
extend Logging
|
||||||
|
|
||||||
OS_BITS = (FFI::Platform::CPU.downcase == "x64") ? 64 : 32
|
OS_BITS = (FFI::Platform::CPU.downcase == "x64") ? 64 : 32
|
||||||
|
|
||||||
def get_vmpath
|
def get_vmpath
|
||||||
@ -22,10 +27,13 @@ module Voicemeeter
|
|||||||
Win32::Registry::HKEY_LOCAL_MACHINE.open(
|
Win32::Registry::HKEY_LOCAL_MACHINE.open(
|
||||||
reg_key.compact.join("\\")
|
reg_key.compact.join("\\")
|
||||||
) do |reg|
|
) do |reg|
|
||||||
value = reg[:UninstallString.to_s]
|
value = reg["UninstallString"]
|
||||||
|
|
||||||
Pathname.new(value).dirname
|
Pathname.new(value).dirname
|
||||||
end
|
end
|
||||||
|
rescue Win32::Registry::Error => e
|
||||||
|
logger.error "#{e.class.name}: #{e.message}"
|
||||||
|
raise Errors::VMInstallError.new "unable to read Voicemeeter path from the registry"
|
||||||
end
|
end
|
||||||
|
|
||||||
module_function :get_vmpath
|
module_function :get_vmpath
|
||||||
|
Loading…
Reference in New Issue
Block a user