@@ -3,7 +3,6 @@ package system
3
3
import (
4
4
"path"
5
5
"path/filepath"
6
- "runtime"
7
6
"strings"
8
7
9
8
"github.com/pkg/errors"
@@ -34,6 +33,10 @@ func DefaultPathEnv(os string) string {
34
33
// - optionally keep the trailing slashes on paths
35
34
// - paths are returned using forward slashes
36
35
func NormalizePath (parent , newPath , inputOS string , keepSlash bool ) (string , error ) {
36
+ if inputOS == "" {
37
+ inputOS = "linux"
38
+ }
39
+
37
40
newPath = toSlash (newPath , inputOS )
38
41
parent = toSlash (parent , inputOS )
39
42
origPath := newPath
@@ -105,6 +108,10 @@ func fromSlash(inputPath, inputOS string) string {
105
108
// On Windows we remove the drive letter and convert the path delimiter to "\".
106
109
// Paths that begin with os.PathSeparator are considered absolute even on Windows.
107
110
func NormalizeWorkdir (current , wd string , inputOS string ) (string , error ) {
111
+ if inputOS == "" {
112
+ inputOS = "linux"
113
+ }
114
+
108
115
wd , err := NormalizePath (current , wd , inputOS , false )
109
116
if err != nil {
110
117
return "" , errors .Wrap (err , "normalizing working directory" )
@@ -129,7 +136,7 @@ func NormalizeWorkdir(current, wd string, inputOS string) (string, error) {
129
136
// - Are UNC paths
130
137
func IsAbs (pth , inputOS string ) bool {
131
138
if inputOS == "" {
132
- inputOS = runtime . GOOS
139
+ inputOS = "linux"
133
140
}
134
141
cleanedPath , err := CheckSystemDriveAndRemoveDriveLetter (pth , inputOS )
135
142
if err != nil {
@@ -170,7 +177,7 @@ func IsAbs(pth, inputOS string) bool {
170
177
// \\.\C$\a --> Fail
171
178
func CheckSystemDriveAndRemoveDriveLetter (path string , inputOS string ) (string , error ) {
172
179
if inputOS == "" {
173
- inputOS = runtime . GOOS
180
+ inputOS = "linux"
174
181
}
175
182
176
183
if inputOS != "windows" {
0 commit comments