示例#1
0
文件: environment.go 项目: ryo33/zenv
func Activate(pid string, dir string) {
	util.PrepareDir(getZenvPath())
	envs := getEnvs(dir)
	settings.Initialize(getZenvPath())
	for _, env := range envs {
		env.ReadSettings()
		env.Activate(pid)
	}
}
示例#2
0
文件: environment.go 项目: ryo33/zenv
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))
		}
	}
}