Skip to content

Commit 3bf17fc

Browse files
author
John Howard
committed
LCOW: Ensure Linux-style paths on copy/add
Signed-off-by: John Howard <[email protected]>
1 parent 1ef1cc8 commit 3bf17fc

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

builder/dockerfile/internals.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -479,11 +479,14 @@ func hostConfigFromOptions(options *types.ImageBuildOptions, isWCOW bool) *conta
479479
return hc
480480
}
481481

482-
// fromSlash works like filepath.FromSlash but with a given OS platform field
483-
func fromSlash(path, platform string) string {
484-
if platform == "windows" {
482+
// fromSlash works like filepath.FromSlash but with a given target operating system
483+
func fromSlash(path, targetOS string) string {
484+
if targetOS == "windows" { // WCOW force Windows slashes
485485
return strings.Replace(path, "/", "\\", -1)
486486
}
487+
if targetOS == "linux" && runtime.GOOS == "windows" { // LCOW, force Linux slashes
488+
return strings.Replace(path, "\\", "/", -1)
489+
}
487490
return path
488491
}
489492

0 commit comments

Comments
 (0)