Skip to content

Commit

Permalink
fixup! Use $XDG_STATE_DIR for state.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
horriblename committed Feb 6, 2024
1 parent 9c81526 commit 62cede3
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions pkg/config/app_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,18 +259,17 @@ var ConfigFilename = "config.yml"
// stateFilePath looks for a possibly existing state file.
// if none exist, the default path is returned and all parent directories are created.
func stateFilePath(filename string) (string, error) {
exists, legacyStateFile := findConfigFile(filename)
if exists {
return legacyStateFile, nil
}

// looks for XDG_STATE_HOME/lazygit/filename
stateFile, err := xdg.SearchStateFile(filepath.Join("lazygit", filename))
if err == nil {
return stateFile, nil
}

exists, legacyStateFile := findConfigFile(filename)

if exists {
return legacyStateFile, nil
}

return xdg.StateFile(filepath.Join("lazygit", filename))
}

Expand Down

0 comments on commit 62cede3

Please sign in to comment.