func (env *Env) Activate(pid string) { storage.ClearTemporal() activated := GetActivated(pid) if !isActivated(activated, env.name) { env.items.Activate(settings.NewInfo(getZenvPath(), env.dir)) //TODO activate child envs } //Add to list storage.WriteTemporal(pid, ACTIVATED, append(activated, env.name)) }
func (env *Env) Deactivate(pid string) { //Remove from list activated := GetActivated(pid) for i, actName := range activated { if actName == env.name { activated = append(activated[:i], activated[i+1:]...) break } } storage.WriteTemporal(pid, ACTIVATED, activated) if !isActivated(activated, env.name) { env.items.Deactivate(settings.NewInfo(getZenvPath(), env.dir)) //TODO deactivate child envs } if len(activated) == 0 { util.RemoveDir(storage.GetStorageDir(storage.TMP, pid)) } }