Updates the XDG path creation to create needed dirs and panic on failure

This commit is contained in:
sloumdrone 2019-12-03 19:22:15 -08:00
parent c6cab8220a
commit 2900702313
1 changed files with 6 additions and 1 deletions

View File

@ -71,7 +71,12 @@ func homePath() string {
func xdgConfigPath() string {
configPath := os.Getenv("XDG_CONFIG_HOME")
if configPath == "" {
return filepath.Join(homePath(), ".config")
fp := filepath.Join(homePath(), ".config")
err := os.MkdirAll(fp, 0755)
if err != nil {
panic("Unable to create configuration directory: ~/.config")
}
return fp
}
return configPath
}