Skip to content

Commit

Permalink
Backwards compatibility
Browse files Browse the repository at this point in the history
If ~/.config/gf doesn't exist, use ~/.gf
  • Loading branch information
Jab2870 committed Jun 24, 2019
1 parent c7fe8f2 commit 3b59b6d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,12 @@ func getPatternDir() (string, error) {
if err != nil {
return "", err
}
return filepath.Join(usr.HomeDir, ".config/gf"), nil
path := filepath.Join(usr.HomeDir, ".config/gf")
if _, err := os.Stat(path); !os.IsNotExist(err) {
// .config/gf exists
return path, nil
}
return filepath.Join(usr.HomeDir, ".gf"), nil
}

func savePattern(name, flags, pat string) error {
Expand Down

0 comments on commit 3b59b6d

Please sign in to comment.