@@ -9,6 +9,26 @@ import (
99 "strings"
1010)
1111
12+ var pathListSeparator string
13+
14+ func init () {
15+ _ = GetPathListSeparator ()
16+ }
17+
18+ func GetPathListSeparator () string {
19+ if pathListSeparator != "" {
20+ return pathListSeparator
21+ }
22+
23+ if strings .Contains (os .Getenv ("PATH" ), ":" ) {
24+ pathListSeparator = ":"
25+ } else {
26+ pathListSeparator = ";"
27+ }
28+
29+ return pathListSeparator
30+ }
31+
1232// CleanPath Removes the sdkm directory from paths
1333//
1434//nolint:nonamedreturns // To optimize result logging
@@ -28,15 +48,15 @@ func CleanPath(path string, cleanPaths ...string) (result string) {
2848 return result
2949 }
3050
31- var splitPaths = strings .Split (path , string ( os . PathListSeparator ) )
51+ var splitPaths = strings .Split (path , pathListSeparator )
3252
3353 splitPaths = slices .DeleteFunc (
3454 splitPaths , func (s string ) bool {
3555 return slices .Contains (cleanPaths , s )
3656 },
3757 )
3858
39- result = strings .Join (splitPaths , string ( os . PathListSeparator ) )
59+ result = strings .Join (splitPaths , pathListSeparator )
4060
4161 return result
4262}
@@ -46,5 +66,5 @@ func AddBeforePath(path string, paths ...string) string {
4666 return path
4767 }
4868
49- return strings .Join (paths , string ( os . PathListSeparator )) + string ( os . PathListSeparator ) + path
69+ return strings .Join (paths , pathListSeparator ) + pathListSeparator + path
5070}
0 commit comments