Fix logical error in getdir_unix.go
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
1e2f96ff09
commit
1e6075d11c
|
@ -11,26 +11,24 @@ import (
|
||||||
// XDG_DATA_HOME is set & if that is not set then assume it to be the
|
// 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
|
// default value which is $HOME/.local/share according to XDG Base
|
||||||
// Directory Specification.
|
// Directory Specification.
|
||||||
func GetDir() string {
|
func GetDir() (grusCacheDir string) {
|
||||||
cacheDir := SysDir()
|
cacheDir := SysDir()
|
||||||
|
|
||||||
// Grus cache directory is cacheDir/grus.
|
// Grus cache directory is cacheDir/grus.
|
||||||
grusCacheDir := fmt.Sprintf("%s/%s", cacheDir,
|
grusCacheDir = fmt.Sprintf("%s/%s", cacheDir,
|
||||||
"grus")
|
"grus")
|
||||||
|
|
||||||
return grusCacheDir
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// SysDir returns the system data directory, this is useful for unveil in
|
// SysDir returns the system data directory, this is useful for unveil in
|
||||||
// OpenBSD.
|
// OpenBSD.
|
||||||
func SysDir() string {
|
func SysDir() (cacheDir string) {
|
||||||
if len(cacheDir) == 0 {
|
cacheDir = os.Getenv("XDG_DATA_HOME")
|
||||||
cacheDir = os.Getenv("XDG_DATA_HOME")
|
|
||||||
}
|
|
||||||
if len(cacheDir) == 0 {
|
if len(cacheDir) == 0 {
|
||||||
cacheDir = fmt.Sprintf("%s/%s/%s", os.Getenv("HOME"),
|
cacheDir = fmt.Sprintf("%s/%s/%s", os.Getenv("HOME"),
|
||||||
".local", "share")
|
".local", "share")
|
||||||
}
|
}
|
||||||
|
|
||||||
return cacheDir
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user