mirror of
https://github.com/restic/restic.git
synced 2025-10-09 02:13:03 +00:00
Honor RESTIC_CACHE_DIR environment variable
Fix #3382: restic check doesn't obey the RESTIC_CACHE_DIR environment variable
This commit is contained in:
7
internal/cache/dir.go
vendored
7
internal/cache/dir.go
vendored
@@ -6,10 +6,15 @@ import (
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
// EnvDir return $RESTIC_CACHE_DIR env
|
||||
func EnvDir() string {
|
||||
return os.Getenv("RESTIC_CACHE_DIR")
|
||||
}
|
||||
|
||||
// DefaultDir returns $RESTIC_CACHE_DIR, or the default cache directory
|
||||
// for the current OS if that variable is not set.
|
||||
func DefaultDir() (cachedir string, err error) {
|
||||
cachedir = os.Getenv("RESTIC_CACHE_DIR")
|
||||
cachedir = EnvDir()
|
||||
if cachedir != "" {
|
||||
return cachedir, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user