Example #1
0
// cacheDir is a helper function to return the 'cache' directory for a given
// application name
func cacheDir(name string) (string, error) {
	homedir, err := utils.GetHomeDir()
	if err != nil {
		return "", err
	}
	// TODO, speciailize for windows, possibly OS X
	return filepath.Join(homedir, ".cache", cachePrefix, name), nil
}
// newDefaultDestination creates a new Destination object.
func newDefaultDestination() (*Destination, error) {
	homeDir, err := utils.GetHomeDir()
	if err != nil {
		return nil, err
	}
	mode, err := GetFilePermissions(homeDir)
	if err != nil {
		return nil, err
	}

	// TODO: Move to const.
	return &Destination{Path: filepath.Join(homeDir, ".ecs"), Mode: mode}, nil
}