Beispiel #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
}
Beispiel #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)
}
Beispiel #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)
}
Beispiel #4
0
func databasePath() (path string) {
	path = gohome.Cache(appName)
	os.MkdirAll(path, 0755)
	return filepath.Join(path, "cache.db")
}
Beispiel #5
0
func TestCache(t *testing.T) {
	cache := gohome.Cache(appName)
	assert.NotEmpty(t, cache)
	assert.Equal(t, home+"/Library/Caches/"+appName, cache)
}
Beispiel #6
0
func TestCacheXdgUnset(t *testing.T) {
	cache := gohome.Cache(appName)
	assert.NotEmpty(t, cache)
	assert.Equal(t, home+"/.cache/"+appName, cache)
}