@@ -10,18 +10,20 @@ import (
1010// When the directory is not absolute, CachePath will try to make a
1111// a cache depending on the operating system.
1212//
13- // TODO: Update this with better examples
1413// NOTE: cache directory will change depending on operating system dependent
1514// For Windows:
1615// PACKER_CACHE_DIR="" CacheDir() => "./packer_cache/
1716// PACKER_CACHE_DIR="" CacheDir("foo") => "./packer_cache/foo
1817// PACKER_CACHE_DIR="bar" CacheDir("foo") => "./bar/foo
1918// PACKER_CACHE_DIR="/home/there" CacheDir("foo", "bar") => "/home/there/foo/bar
2019// For Unix:
21- // PACKER_CACHE_DIR="", XDG_CONFIG_HOME="", Default_config CacheDir() => "$HOME/cache/packer"
22- // PACKER_CACHE_DIR="", XDG_CONFIG_HOME="", Default_config CacheDir("foo") => "$HOME/cache/packer/foo"
23- // PACKER_CACHE_DIR="bar", XDG_CONFIG_HOME="", Default_config CacheDir("foo") => "./bar/foo
24- // PACKER_CACHE_DIR="/home/there", XDG_CONFIG_HOME="", Default_config CacheDir("foo", "bar") => "/home/there/foo/bar
20+ // NOTE: PACKER_CACHE_DIR will be used over XDG_CACHE_HOME environment variable
21+ // PACKER_CACHE_DIR="", XDG_CACHE_HOME="", CacheDir() => "$HOME/cache/packer"
22+ // PACKER_CACHE_DIR="", XDG_CACHE_HOME="", CacheDir("foo") => "$HOME/cache/packer/foo"
23+ // PACKER_CACHE_DIR="bar", XDG_CACHE_HOME="", CacheDir("foo") => "./bar/foo"
24+ // PACKER_CACHE_DIR="/home/there", XDG_CACHE_HOME="", CacheDir("foo", "bar") => "/home/there/foo/bar"
25+ // PACKER_CACHE_DIR="", XDG_CACHE_HOME="/home/there", CacheDir("foo", "bar") => "/home/there/foo/bar"
26+ // PACKER_CACHE_DIR="/foo", XDG_CACHE_HOME="/bar", CacheDir("a", "b") => "/foo/a/b"
2527func CachePath (paths ... string ) (path string , err error ) {
2628 defer func () {
2729 // create the dir based on return path if it doesn't exist
0 commit comments