// Home finds the right home folder to use func Home() string { home := os.Getenv("ANTIBODY_HOME") if home == "" { home = gohome.Cache("antibody") } return home }
func TestCacheWindows(t *testing.T) { os.Setenv("APPDATA", appdata) defer os.Unsetenv("APPDATA") cache := gohome.Cache(appName) assert.NotEmpty(t, cache) assert.Equal(t, appdata+appName, cache) }
func TestCacheXdgSet(t *testing.T) { xdgCache := home + "/.xdgcache/" os.Setenv("XDG_CACHE_HOME", xdgCache) defer os.Unsetenv("XDG_CACHE_HOME") cache := gohome.Cache(appName) assert.NotEmpty(t, cache) assert.Equal(t, xdgCache+appName, cache) }
func databasePath() (path string) { path = gohome.Cache(appName) os.MkdirAll(path, 0755) return filepath.Join(path, "cache.db") }
func TestCache(t *testing.T) { cache := gohome.Cache(appName) assert.NotEmpty(t, cache) assert.Equal(t, home+"/Library/Caches/"+appName, cache) }
func TestCacheXdgUnset(t *testing.T) { cache := gohome.Cache(appName) assert.NotEmpty(t, cache) assert.Equal(t, home+"/.cache/"+appName, cache) }