Esempio n. 1
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)
	}
}
Esempio n. 2
0
func Clean(current string) {
	settings.Initialize(getZenvPath())
	tmpPath := storage.GetStoragePath(storage.TMP)
	for _, dir := range util.GetAllDir(tmpPath) {
		if current != dir {
			activated := util.ReadFile(path.Join(tmpPath, dir, ACTIVATED))
			for _, act := range activated {
				env := getLocalEnv(act)
				if env != nil {
					env.ReadSettings()
					env.items.Clean(settings.NewInfo(getZenvPath(), env.dir))
				}
			}
			util.RemoveDir(path.Join(tmpPath, dir))
		}
	}
}