"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
config: use os.UserCacheDir from go stdlib to find cache dir #6095
Nick Craig-Wood27176cc6bb55
diff --git a/fs/config/config.go b/fs/config/config.goindex 65780c367..0c84127e6 100644--- a/fs/config/config.go+++ b/fs/config/config.go@@ -674,41 +674,11 @@ func Dump() error {}// makeCacheDir returns a directory to use for caching.-//-// Code borrowed from go stdlib until it is made publicfunc makeCacheDir() (dir string) {- // Compute default location.- switch runtime.GOOS {- case "windows":- dir = os.Getenv("LocalAppData")-- case "darwin":- dir = os.Getenv("HOME")- if dir != "" {- dir += "/Library/Caches"- }-- case "plan9":- dir = os.Getenv("home")- if dir != "" {- // Plan 9 has no established per-user cache directory,- // but $home/lib/xyz is the usual equivalent of $HOME/.xyz on Unix.- dir += "/lib/cache"- }-- default: // Unix- // https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html- dir = os.Getenv("XDG_CACHE_HOME")- if dir == "" {- dir = os.Getenv("HOME")- if dir != "" {- dir += "/.cache"- }- }- }-- // if no dir found then use TempDir - we will have a cachedir!- if dir == "" {+ dir, err := os.UserCacheDir()+ if err != nil || dir == "" {+ fs.Debugf(nil, "Failed to find user cache dir, using temporary directory: %v", err)+ // if no dir found then use TempDir - we will have a cachedir!dir = os.TempDir()}return filepath.Join(dir, "rclone")