From 9f72034eb334a3150984959beb04e11dff0f3dc9 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 24 May 2022 21:20:13 +0200 Subject: [PATCH] config: use os.UserConfigDir --- config/config.go | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/config/config.go b/config/config.go index d1a2c19..c4de820 100644 --- a/config/config.go +++ b/config/config.go @@ -1,19 +1,14 @@ package config import ( - "errors" "os" "path/filepath" ) func Path(filename string) (string, error) { - configHome := os.Getenv("XDG_CONFIG_HOME") - if configHome == "" { - home := os.Getenv("HOME") - if home == "" { - return "", errors.New("HOME not set") - } - configHome = filepath.Join(home, ".config") + configHome, err := os.UserConfigDir() + if err != nil { + return "", err } p := filepath.Join(configHome, "hydroxide", filename)