mirror of
https://github.com/octoleo/restic.git
synced 2024-12-22 10:58:55 +00:00
Merge pull request #1454 from restic/fix-cache-dir
Fix cache dir detection
This commit is contained in:
commit
410efe0694
3
internal/cache/cache.go
vendored
3
internal/cache/cache.go
vendored
@ -86,6 +86,9 @@ func writeCachedirTag(dir string) error {
|
||||
func New(id string, basedir string) (c *Cache, err error) {
|
||||
if basedir == "" {
|
||||
basedir, err = DefaultDir()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
err = mkdirCacheDir(basedir)
|
||||
|
10
internal/cache/dir.go
vendored
10
internal/cache/dir.go
vendored
@ -56,10 +56,16 @@ func DefaultDir() (cachedir string, err error) {
|
||||
cachedir, err = darwinCacheDir()
|
||||
case "windows":
|
||||
cachedir, err = windowsCacheDir()
|
||||
default:
|
||||
// Default to XDG for Linux and any other OSes.
|
||||
cachedir, err = xdgCacheDir()
|
||||
}
|
||||
|
||||
// Default to XDG for Linux and any other OSes.
|
||||
return xdgCacheDir()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return cachedir, nil
|
||||
}
|
||||
|
||||
func mkdirCacheDir(cachedir string) error {
|
||||
|
Loading…
Reference in New Issue
Block a user