From 23ae316a0a36b0d54456c201cc16d64faef33487 Mon Sep 17 00:00:00 2001 From: Todd Palmer <3467709+trpalmer@users.noreply.github.com> Date: Tue, 28 May 2024 17:22:43 -0600 Subject: [PATCH] Path separator as colon on powershell Linux (#82) 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 --- CHANGELOG.md | 2 ++ cmd/gvm/internal/shellfmt/format.go | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 18a9d18..13c32dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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] diff --git a/cmd/gvm/internal/shellfmt/format.go b/cmd/gvm/internal/shellfmt/format.go index b29d252..229da85 100644 --- a/cmd/gvm/internal/shellfmt/format.go +++ b/cmd/gvm/internal/shellfmt/format.go @@ -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) }