Skip to content

Commit

Permalink
awinadb: Switch to panic()
Browse files Browse the repository at this point in the history
  • Loading branch information
przekichane committed May 18, 2023
1 parent 8ade75d commit 7345e72
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
6 changes: 2 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,10 @@ func main() {
if response == "y" || response == "Y" {
err = os.RemoveAll(PLATFORM_TOOLS_PATH)
if err != nil {
fmt.Println("Failed to remove " + PLATFORM_TOOLS_PATH + "! Aborting...")
Exit(1)
panic("Failed to remove " + PLATFORM_TOOLS_PATH + "! Aborting...")
}
} else {
fmt.Println("Aborting...")
Exit(1)
panic("Aborting...")
}
}

Expand Down
10 changes: 3 additions & 7 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"archive/zip"
"fmt"
"io"
"log"
"net/http"
"os"
"os/user"
Expand All @@ -26,7 +25,6 @@ func CheckOS() {
fmt.Println("This program works only on windows! Aborting")
Exit(1)
}

}

func Unzip(src, dest string) error {
Expand Down Expand Up @@ -122,18 +120,16 @@ func appendToPath(value string) {

k, err := registry.OpenKey(registry.USERS, SID+`\Environment`, registry.ALL_ACCESS)
if err != nil {
fmt.Println(err)
Exit(1)
panic(err)
}
defer k.Close()

currentPath, _, err := k.GetStringValue(key)
if err != nil {
fmt.Println(err)
Exit(1)
panic(err)
}
err = k.SetStringValue(key, currentPath+";"+value)
if err != nil {
log.Fatal(err)
panic(err)
}
}

0 comments on commit 7345e72

Please sign in to comment.