Skip to content

Commit

Permalink
mod: clear env
Browse files Browse the repository at this point in the history
  • Loading branch information
aooohan committed May 18, 2024
1 parent a2645d8 commit b0ef324
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cmd/commands/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func outputJSON() error {
}
tvs.FilterTools(func(name, version string) bool {
if lookupSdk, err := manager.LookupSdk(name); err == nil {
if keys, err := lookupSdk.EnvKeys(internal.Version(version), internal.ShellLocation); err == nil {
if keys, err := lookupSdk.EnvKeys(internal.Version(version), internal.OriginalLocation); err == nil {
data.SDKs[lookupSdk.Plugin.Name] = keys.Variables
data.Paths = append(data.Paths, keys.Paths.Slice()...)
return true
Expand Down
12 changes: 6 additions & 6 deletions internal/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -705,12 +705,6 @@ func (b *Sdk) label(version Version) string {
func (b *Sdk) ClearCurrentEnv() error {
current := b.Current()

fmt.Println("Cleaning up current link...")
curPath := filepath.Join(b.InstallPath, "current")
if err := os.RemoveAll(curPath); err != nil {
return fmt.Errorf("failed to remove current link, err:%w", err)
}

if current != "" {
envKeys, err := b.MockEnvKeys(current, GlobalLocation)
if err != nil {
Expand Down Expand Up @@ -739,6 +733,12 @@ func (b *Sdk) ClearCurrentEnv() error {
_ = envManager.Flush()
}

fmt.Println("Cleaning up current link...")
curPath := filepath.Join(b.InstallPath, "current")
if err := os.RemoveAll(curPath); err != nil {
return fmt.Errorf("failed to remove current link, err:%w", err)
}

// clear tool versions
toolVersion, err := toolset.NewMultiToolVersions([]string{
b.sdkManager.PathMeta.CurTmpPath,
Expand Down

0 comments on commit b0ef324

Please sign in to comment.