Fix error checking

This commit is contained in:
Sandro Jäckel 2024-03-15 15:29:44 +01:00
parent d6e1cd2633
commit 91612b9d26
No known key found for this signature in database
GPG Key ID: 3AF5A43A3EECC2E5
1 changed files with 32 additions and 8 deletions

View File

@ -112,10 +112,22 @@ func detectAndInstallBrowsers(startPath string) error {
fmt.Printf("Found mozilla-like browser: %s\n", path)
fmt.Println("Removing old manifest and proxy script")
os.Chown(path+"/com.8bit.bitwarden.json", 7, 7)
os.Remove(path + "/com.8bit.bitwarden.json")
os.Chown(path+"/goldwarden-proxy.sh", 7, 7)
os.Remove(path + "/goldwarden-proxy.sh")
err = os.Chown(path+"/com.8bit.bitwarden.json", 7, 7)
if err != nil {
return err
}
err = os.Remove(path + "/com.8bit.bitwarden.json")
if err != nil {
return err
}
err = os.Chown(path+"/goldwarden-proxy.sh", 7, 7)
if err != nil {
return err
}
err = os.Remove(path + "/goldwarden-proxy.sh")
if err != nil {
return err
}
fmt.Println("Writing new manifest")
manifest := strings.Replace(templateMozilla, "PATH", path+"/goldwarden-proxy.sh", 1)
@ -133,10 +145,22 @@ func detectAndInstallBrowsers(startPath string) error {
fmt.Printf("Found chrome-like browser: %s\n", path)
fmt.Println("Removing old manifest and proxy script")
os.Chown(path+"/com.8bit.bitwarden.json", 7, 7)
os.Remove(path + "/com.8bit.bitwarden.json")
os.Chown(path+"/goldwarden-proxy.sh", 7, 7)
os.Remove(path + "/goldwarden-proxy.sh")
err = os.Chown(path+"/com.8bit.bitwarden.json", 7, 7)
if err != nil {
return err
}
err = os.Remove(path + "/com.8bit.bitwarden.json")
if err != nil {
return err
}
err = os.Chown(path+"/goldwarden-proxy.sh", 7, 7)
if err != nil {
return err
}
err = os.Remove(path + "/goldwarden-proxy.sh")
if err != nil {
return err
}
fmt.Println("Writing new manifest")
manifest := strings.Replace(templateChrome, "PATH", path+"/goldwarden-proxy.sh", 1)