From 2900702313374f6d40ab48a94a218aa037048fab Mon Sep 17 00:00:00 2001 From: sloumdrone Date: Tue, 3 Dec 2019 19:22:15 -0800 Subject: [PATCH] Updates the XDG path creation to create needed dirs and panic on failure --- defaults.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/defaults.go b/defaults.go index a89e7f5..52bb828 100644 --- a/defaults.go +++ b/defaults.go @@ -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 }