Пример #1
0
func (env *Env) Write() {
	util.RemoveDir(env.dir)
	util.PrepareDir(env.dir)
	util.PrepareDir(getZenvPath())
	util.PrepareDir(getEnvsPath())
	env.writeInfo()
	env.items.Write(env.dir)
	if !env.global {
		env.addEnvDir()
	}
}
Пример #2
0
func WriteStorage(name, key, subkey string, data []string) {
	if len(name) == 0 {
		name = STORAGE
	}
	util.PrepareDir(GetStorageDir(name, key))
	util.WriteFile(getStorageFilePath(name, key, subkey), data)
}
Пример #3
0
func Activate(pid string, dir string) {
	util.PrepareDir(getZenvPath())
	envs := getEnvs(dir)
	settings.Initialize(getZenvPath())
	for _, env := range envs {
		env.ReadSettings()
		env.Activate(pid)
	}
}
Пример #4
0
func NewEnv(global bool, name string, recursive, exclusive bool) *Env {
	var dir string
	if global {
		dir = getGlobalPath(name)
	} else {
		dir = getLocalPath(name)
	}
	util.PrepareDir(dir)
	env := &Env{
		global:    global,
		name:      name,
		dir:       dir,
		recursive: recursive,
		exclusive: exclusive,
		items:     make(settings.Items),
	}
	return env
}
Пример #5
0
func read(name string) *Env {
	util.PrepareDir(path.Join(util.GetHomeDir(), zenv.ZENV, ENVS))
	env := readInfo(name)
	return env
}
Пример #6
0
Файл: link.go Проект: ryo33/zenv
func initializeLink(dir string) {
	pa := GetVBinPath(dir)
	util.RemoveDir(pa)
	util.PrepareDir(pa)
}