Example #1
0
// Home finds the right home folder to use
func Home() string {
	home := os.Getenv("ANTIBODY_HOME")
	if home == "" {
		home = gohome.Cache("antibody")
	}
	return home
}
Example #2
0
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)
}
Example #3
0
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)
}
Example #4
0
func databasePath() (path string) {
	path = gohome.Cache(appName)
	os.MkdirAll(path, 0755)
	return filepath.Join(path, "cache.db")
}
Example #5
0
func TestCache(t *testing.T) {
	cache := gohome.Cache(appName)
	assert.NotEmpty(t, cache)
	assert.Equal(t, home+"/Library/Caches/"+appName, cache)
}
Example #6
0
func TestCacheXdgUnset(t *testing.T) {
	cache := gohome.Cache(appName)
	assert.NotEmpty(t, cache)
	assert.Equal(t, home+"/.cache/"+appName, cache)
}