Skip to content

Commit

Permalink
correctly write to user.js
Browse files Browse the repository at this point in the history
  • Loading branch information
arguablykomodo committed Oct 8, 2018
1 parent 0904446 commit 277bd2c
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions install.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 277bd2c

Please sign in to comment.