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