Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ func envCommand(logger *log.Logger, shimmedCommand string, args []string) error
}

func setPath(paths []string) string {
return strings.Join(paths, ":") + ":" + os.Getenv("PATH")
return strings.Join(paths, string(os.PathListSeparator)) + string(os.PathListSeparator) + os.Getenv("PATH")
}

func execCommand(logger *log.Logger, command string, args []string) error {
Expand Down
5 changes: 3 additions & 2 deletions internal/paths/paths.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@
package paths

import (
"path/filepath"
"strings"
)

// RemoveFromPath returns the PATH without asdf shims path
func RemoveFromPath(currentPath, pathToRemove string) string {
var newPaths []string

for _, fspath := range strings.Split(currentPath, ":") {
for _, fspath := range filepath.SplitList(currentPath) {
if fspath != pathToRemove {
newPaths = append(newPaths, fspath)
}
}

return strings.Join(newPaths, ":")
return strings.Join(newPaths, string(filepath.ListSeparator))
}