diff options
author | 是蓝兔哟~ <49941141+Dragon1573@users.noreply.github.com> | 2023-12-24 20:37:17 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-24 07:37:17 -0500 |
commit | 8bca0f17eeb328a87da72a88b2abcfeafcdbf09d (patch) | |
tree | 4a22ea7ad286243c446150ce481ab250ff768e73 | |
parent | d7fb6e1045ac326f8844b1dccad4f80ded66f2e7 (diff) |
[Fix] Firefox inspecting logic on Windows (#502)
* Fix (firefox_windows.go): Release resources
It seems `defer` keyword is using to release and close some resources.
It should be added to `getFirefoxPath` function.
Signed-off-by: Dragon1573 <49941141+Dragon1573@users.noreply.github.com>
* Fix (firefox_windows.go): Registry path
For Mozilla Firefox Stable edition, it's incorrect in `getFirefoxPath` function.
Signed-off-by: Dragon1573 <49941141+Dragon1573@users.noreply.github.com>
* Fix (firefox_windows.go): Registry Value
Signed-off-by: Dragon1573 <49941141+Dragon1573@users.noreply.github.com>
* Update (firefox_windows.go): Reformat code
Advices from GitHub Workflows, try fix this using GitHub Web.
---------
Signed-off-by: Dragon1573 <49941141+Dragon1573@users.noreply.github.com>
-rw-r--r-- | interfacer/src/browsh/firefox_windows.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/interfacer/src/browsh/firefox_windows.go b/interfacer/src/browsh/firefox_windows.go index 3eb7754..7bb1c08 100644 --- a/interfacer/src/browsh/firefox_windows.go +++ b/interfacer/src/browsh/firefox_windows.go @@ -17,11 +17,13 @@ func getFirefoxPath() string { k, err := registry.OpenKey( registry.LOCAL_MACHINE, - `Software\Mozilla\`+flavor+` `+versionString+`\bin`, + `Software\Mozilla\`+flavor+`\`+versionString+`\Main`, registry.QUERY_VALUE) if err != nil { Shutdown(fmt.Errorf("Error reading Windows registry: %w", err)) } + defer k.Close() + path, _, err := k.GetStringValue("PathToExe") if err != nil { Shutdown(fmt.Errorf("Error reading Windows registry: %w", err)) @@ -42,7 +44,7 @@ func getWindowsFirefoxVersionString() string { } defer k.Close() - versionString, _, err := k.GetStringValue("") + versionString, _, err := k.GetStringValue("CurrentVersion") if err != nil { Shutdown(fmt.Errorf("Error reading Windows registry: %w", err)) } |