From 1aa984d006401b8c90ec2a4ec8a06a5ab18a15a9 Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Wed, 22 Feb 2023 20:02:12 -0300 Subject: [PATCH] fix: convert to forward slashes inside gio.Copy (#3794) closes #3776 Signed-off-by: Carlos A Becker --- internal/gio/copy.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/gio/copy.go b/internal/gio/copy.go index e027155b2..023f9157c 100644 --- a/internal/gio/copy.go +++ b/internal/gio/copy.go @@ -18,16 +18,19 @@ func Copy(src, dst string) error { // CopyWithMode recursively copies src into dst with the given mode. // The given mode applies only to files. Their parent dirs will have the same mode as their src counterparts. func CopyWithMode(src, dst string, mode os.FileMode) error { + src = filepath.ToSlash(src) + dst = filepath.ToSlash(dst) return filepath.Walk(src, func(path string, info os.FileInfo, err error) error { if err != nil { return fmt.Errorf("failed to copy %s to %s: %w", src, dst, err) } + path = filepath.ToSlash(path) // We have the following: // - src = "a/b" // - dst = "dist/linuxamd64/b" // - path = "a/b/c.txt" // So we join "a/b" with "c.txt" and use it as the destination. - dst := filepath.Join(dst, strings.Replace(path, src, "", 1)) + dst := filepath.ToSlash(filepath.Join(dst, strings.Replace(path, src, "", 1))) log.WithFields(log.Fields{ "src": path, "dst": dst,