Skip to content

Commit

Permalink
Path separator as colon on powershell Linux (#82)
Browse files Browse the repository at this point in the history
Powershell can be used on non-Windows OSes, and in that case the path list separator should be a colon instead of semi-colon. So use the os.PathListSeparator when generating the powershell PATH value.

Fixes #81
  • Loading branch information
trpalmer authored May 28, 2024
1 parent 72f17c2 commit 23ae316
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).

### Fixed

- Fixed path separator format for Powershell on Linux [#81](https://github.com/andrewkroh/gvm/issues/81)

### Added

## [0.5.2]
Expand Down
4 changes: 2 additions & 2 deletions cmd/gvm/internal/shellfmt/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ func (*powershellFormatter) Set(name, val string) string {
}

func (*powershellFormatter) Prepend(name, val string) string {
return fmt.Sprintf(`$env:%v = "%v;$env:%v"`, name, val, name)
return fmt.Sprintf(`$env:%v = "%v%c$env:%v"`, name, val, os.PathListSeparator, name)
}

func (*powershellFormatter) Append(name, val string) string {
return fmt.Sprintf(`$env:%v="$env:%v;%v"`, name, name, val)
return fmt.Sprintf(`$env:%v="$env:%v%c%v"`, name, name, os.PathListSeparator, val)
}

0 comments on commit 23ae316

Please sign in to comment.