Skip to content

Commit

Permalink
Moves config for new users into a .config folder per #33
Browse files Browse the repository at this point in the history
  • Loading branch information
lleadbet committed Jul 13, 2021
1 parent 6d1d730 commit ea513fe
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions internal/util/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,19 @@ func GetApplicationDir() (string, error) {
return "", err
}

legacyFolder := false

// check if the home/.twitch-cli folder exists; if so, use that as the path
if _, err := os.Stat(filepath.Join(home, ".twitch-cli")); !os.IsNotExist(err) {
legacyFolder = true
}

path := filepath.Join(home, subFolder)

if !legacyFolder {
path = filepath.Join(home, ".config", subFolder) // issue #33- putting into a subfolder to avoid clutter
}

if _, err := os.Stat(path); os.IsNotExist(err) {
os.Mkdir(path, 0700)
}
Expand Down

0 comments on commit ea513fe

Please sign in to comment.