Skip to content

Commit

Permalink
try XDG_CONFIG_HOME
Browse files Browse the repository at this point in the history
  • Loading branch information
maxice8 committed Jul 25, 2019
1 parent 8fb1a02 commit 63bb26a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ func loadConfig() (string, string, string) {
home = u.HomeDir
}
}
confpath := path.Join(home, ".config")
// Try XDG_CONFIG_HOME which is declared in XDG base directory specification
confpath := os.Getenv("XDG_CONFIG_HOME")
if confpath == "" {
confpath = path.Join(home, ".config")
}
if _, err := os.Stat(confpath); os.IsNotExist(err) {
os.Mkdir(confpath, 0700)
}
Expand Down

0 comments on commit 63bb26a

Please sign in to comment.