From 206a776f64c9163ab597c25a61040c08c012dfd0 Mon Sep 17 00:00:00 2001 From: Andinus Date: Sat, 4 Apr 2020 21:59:01 +0530 Subject: Fix unveil rules --- cache/getdir_unix.go | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'cache') diff --git a/cache/getdir_unix.go b/cache/getdir_unix.go index 62dd5ed..a65d389 100644 --- a/cache/getdir_unix.go +++ b/cache/getdir_unix.go @@ -12,6 +12,18 @@ import ( // that is not set then assume it to be the default value which is // $HOME/.cache according to XDG Base Directory Specification. func GetDir() string { + cacheDir := Dir() + + // Cetus cache directory is cacheDir/cetus. + cetusCacheDir := fmt.Sprintf("%s/%s", cacheDir, + "cetus") + + return cetusCacheDir +} + +// Dir returns the system cache directory, this is useful for unveil +// in OpenBSD. +func Dir() string { cacheDir := os.Getenv("CETUS_CACHE_DIR") if len(cacheDir) == 0 { cacheDir = os.Getenv("XDG_CACHE_HOME") @@ -21,9 +33,5 @@ func GetDir() string { ".cache") } - // Cetus cache directory is cacheDir/cetus. - cetusCacheDir := fmt.Sprintf("%s/%s", cacheDir, - "cetus") - - return cetusCacheDir + return cacheDir } -- cgit 1.4.1-2-gfad0