Skip to content

Commit

Permalink
Use os.UserConfigDir() instead of calculating it manually (and poorly)
Browse files Browse the repository at this point in the history
  • Loading branch information
tadzik committed Jan 6, 2025
1 parent a48ec83 commit 7b0fd48
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@ func findInKey(str string, km map[string]struct{}) bool {
}

func parseFlags() error {
configHome := os.Getenv("XDG_CONFIG_HOME")
if configHome == "" {
configHome = filepath.Join(os.Getenv("HOME"), ".config")
configHome, err := os.UserConfigDir()
if err != nil {
return fmt.Errorf("failed to determine user config directory: %s", err)
}
rcFilePath := filepath.Join(configHome, "dufrc")
file, err := os.Open(rcFilePath)
Expand Down

0 comments on commit 7b0fd48

Please sign in to comment.