diff --git a/src/nvm.go b/src/nvm.go index 3863487da320ad3ee7e4fea3b32130a862c8ad5a..3f33447503d87b85df7fe4fbb481d2c31546481a 100644 --- a/src/nvm.go +++ b/src/nvm.go @@ -375,7 +375,7 @@ func use(version string, cpuarch string) { // Create or update the symlink sym, _ := os.Stat(env.symlink) if sym != nil { - cmd := exec.Command(filepath.Join(env.root, "elevate.cmd"), "cmd", "/C", "rmdir", env.symlink) + cmd := exec.Command(filepath.Join(env.root, "elevate.cmd"), "cmd", "/C", "rmdir", filepath.Clean(env.symlink)) var output bytes.Buffer var _stderr bytes.Buffer cmd.Stdout = &output @@ -387,7 +387,7 @@ func use(version string, cpuarch string) { } } - c := exec.Command(filepath.Join(env.root, "elevate.cmd"), "cmd", "/C", "mklink", "/D", env.symlink, filepath.Join(env.root, "v"+version)) + c := exec.Command(filepath.Join(env.root, "elevate.cmd"), "cmd", "/C", "mklink", "/D", filepath.Clean(env.symlink), filepath.Join(env.root, "v"+version)) var out bytes.Buffer var stderr bytes.Buffer c.Stdout = &out