Skip to content

Commit 869545c

Browse files
committed
unixToWindowsPath
1 parent 2e9f563 commit 869545c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

cli/open.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ func windowsJoinPath(elem ...string) string {
268268

269269
var s string
270270
for _, e := range elem {
271-
e = strings.ReplaceAll(e, "/", "\\")
271+
e = unixToWindowsPath(e)
272272
if e == "" {
273273
continue
274274
}
@@ -281,6 +281,10 @@ func windowsJoinPath(elem ...string) string {
281281
return s
282282
}
283283

284+
func unixToWindowsPath(p string) string {
285+
return strings.ReplaceAll(p, "/", "\\")
286+
}
287+
284288
// resolveAgentAbsPath resolves the absolute path to a file or directory in the
285289
// workspace. If the path is relative, it will be resolved relative to the
286290
// workspace's expanded directory. If the path is absolute, it will be returned
@@ -305,7 +309,7 @@ func resolveAgentAbsPath(workingDirectory, relOrAbsPath, agentOS string, local b
305309
return p, nil
306310

307311
case agentOS == "windows":
308-
relOrAbsPath = strings.ReplaceAll(relOrAbsPath, "/", "\\")
312+
relOrAbsPath = unixToWindowsPath(relOrAbsPath)
309313
switch {
310314
case workingDirectory != "" && !isWindowsAbsPath(relOrAbsPath):
311315
return windowsJoinPath(workingDirectory, relOrAbsPath), nil

0 commit comments

Comments
 (0)