diff --git a/install.go b/install.go index 6bebd16..3641645 100644 --- a/install.go +++ b/install.go @@ -222,19 +222,24 @@ func install(profilePath string, generateUUIDs bool, setTheme bool) (string, err // Set dark theme if setTheme { userJs := filepath.Join(profilePath, "user.js") - err = backUp(userJs) - if err != nil { - return "Couldn't backup user.js", err - } + userJsContent := []byte{} - err = createFile(userJs) - if err != nil { - return "Couldn't create user.js", err + exists, _, err := pathExists(userJs) + if exists { + userJsContent, err = ioutil.ReadFile(userJs) + if err != nil { + return "Couldn't read user.js", err + } + } else { + err = createFile(userJs) + if err != nil { + return "Couldn't create user.js", err + } } - userJsContent, err := ioutil.ReadFile(userJs) + err = backUp(userJs) if err != nil { - return "Couldn't read user.js", err + return "Couldn't backup user.js", err } if !strings.Contains(string(userJsContent), darkThemeConfig) {