Skip to content

Commit

Permalink
[Fix] Firefox inspecting logic on Windows (#502)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>

* Fix (firefox_windows.go): Registry path

For Mozilla Firefox Stable edition, it's incorrect in `getFirefoxPath` function.

Signed-off-by: Dragon1573 <[email protected]>

* Fix (firefox_windows.go): Registry Value

Signed-off-by: Dragon1573 <[email protected]>

* Update (firefox_windows.go): Reformat code

Advices from GitHub Workflows, try fix this using GitHub Web.

---------

Signed-off-by: Dragon1573 <[email protected]>
  • Loading branch information
Dragon1573 authored Dec 24, 2023
1 parent d7fb6e1 commit 8bca0f1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions interfacer/src/browsh/firefox_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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))
}
Expand Down

0 comments on commit 8bca0f1

Please sign in to comment.