Skip to content

Commit

Permalink
Use state dir for state.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
horriblename committed Dec 20, 2023
1 parent 06ec3c0 commit 60ba9b6
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions pkg/config/app_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ func configFilePath(filename string) (string, error) {

var ConfigFilename = "config.yml"

func cacheFilePath(filename string) (string, error) {
func stateFilePath(filename string) (string, error) {
return xdg.StateFile(path.Join("lazygit", filename))
}

Expand All @@ -270,7 +270,7 @@ func (c *AppConfig) SaveAppState() error {
return err
}

filepath, err := cacheFilePath("state.yml")
filepath, err := stateFilePath("state.yml")
if err != nil {
return err
}
Expand All @@ -288,12 +288,8 @@ func (c *AppConfig) SaveAppState() error {
func loadAppState() (*AppState, error) {
appState := getDefaultAppState()

filepath, err := configFilePath("state.yml")
filepath, err := stateFilePath("state.yml")
if err != nil {
if os.IsPermission(err) {
// apparently when people have read-only permissions they prefer us to fail silently
return appState, nil
}
return nil, err
}

Expand Down

0 comments on commit 60ba9b6

Please sign in to comment.