summary refs log tree commit diff stats
path: root/storage
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2020-04-06 23:21:05 +0530
committerAndinus <andinus@nand.sh>2020-04-06 23:24:35 +0530
commit1e6075d11caa9565e82707fff06e64a7c648464f (patch)
tree62279a03fbf2fac77f90c00f300996c37ade139f /storage
parent1e2f96ff09573fdcaae8d7c0b304c46cad15eb79 (diff)
downloadgrus-1e6075d11caa9565e82707fff06e64a7c648464f.tar.gz
Fix logical error in getdir_unix.go
Diffstat (limited to 'storage')
-rw-r--r--storage/getdir_unix.go14
1 files changed, 6 insertions, 8 deletions
diff --git a/storage/getdir_unix.go b/storage/getdir_unix.go
index 758c048..6f975db 100644
--- a/storage/getdir_unix.go
+++ b/storage/getdir_unix.go
@@ -11,26 +11,24 @@ import (
 // XDG_DATA_HOME is set & if that is not set then assume it to be the
 // default value which is $HOME/.local/share according to XDG Base
 // Directory Specification.
-func GetDir() string {
+func GetDir() (grusCacheDir string) {
 	cacheDir := SysDir()
 
 	// Grus cache directory is cacheDir/grus.
-	grusCacheDir := fmt.Sprintf("%s/%s", cacheDir,
+	grusCacheDir = fmt.Sprintf("%s/%s", cacheDir,
 		"grus")
 
-	return grusCacheDir
+	return
 }
 
 // SysDir returns the system data directory, this is useful for unveil in
 // OpenBSD.
-func SysDir() string {
-	if len(cacheDir) == 0 {
-		cacheDir = os.Getenv("XDG_DATA_HOME")
-	}
+func SysDir() (cacheDir string) {
+	cacheDir = os.Getenv("XDG_DATA_HOME")
 	if len(cacheDir) == 0 {
 		cacheDir = fmt.Sprintf("%s/%s/%s", os.Getenv("HOME"),
 			".local", "share")
 	}
 
-	return cacheDir
+	return
 }