From a221ebe413cd773097709060ab32fc6e490af413 Mon Sep 17 00:00:00 2001 From: mpl Date: Sat, 22 Jun 2013 01:30:20 +0200 Subject: [PATCH] osutil: change paths to be xdg compliant http://camlistore.org/issue/152 Change-Id: Idfcf167158df1e12eaeb2ec802f14e0994e19d8b --- pkg/osutil/paths.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/osutil/paths.go b/pkg/osutil/paths.go index 247669ebf..b5e3b9ebf 100644 --- a/pkg/osutil/paths.go +++ b/pkg/osutil/paths.go @@ -76,7 +76,10 @@ func CamliConfigDir() string { if runtime.GOOS == "windows" { return filepath.Join(os.Getenv("APPDATA"), "Camlistore") } - return filepath.Join(HomeDir(), ".camlistore") + if xdg := os.Getenv("XDG_CONFIG_HOME"); xdg != "" { + return filepath.Join(xdg, "camlistore") + } + return filepath.Join(HomeDir(), ".config", "camlistore") } func UserServerConfigPath() string { @@ -84,7 +87,7 @@ func UserServerConfigPath() string { } func UserClientConfigPath() string { - return filepath.Join(CamliConfigDir(), "config") + return filepath.Join(CamliConfigDir(), "client-config.json") } func IdentitySecretRing() string {