Skip to content

Commit

Permalink
Fix path separator issues on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
pehlert committed Nov 17, 2018
1 parent 9098e42 commit fb90748
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions pkg/skaffold/sync/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"context"
"fmt"
"os/exec"
"path"
"path/filepath"
"strings"

Expand Down Expand Up @@ -106,7 +105,7 @@ func intersect(context string, syncMap map[string]string, files []string) (map[s
}

if match {
staticPath := strings.Split(p, "*")[0]
staticPath := strings.Split(filepath.FromSlash(p), "*")[0]

// Every file must match at least one sync pattern, if not we'll have to
// skip the entire sync
Expand All @@ -117,7 +116,7 @@ func intersect(context string, syncMap map[string]string, files []string) (map[s
// a linux filesystem.
if util.HasMeta(p) {
relPathDynamic := strings.TrimPrefix(relPath, staticPath)
dst = path.Join(dst, relPathDynamic)
dst = filepath.Join(dst, relPathDynamic)
}
ret[f] = dst
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/skaffold/sync/sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func TestNewSyncItem(t *testing.T) {
expected: &Item{
Image: "test:123",
Copy: map[string]string{
filepath.Join("node", "src/app/server/server.js"): "src/app/server/server.js",
filepath.Join("node", "src/app/server/server.js"): filepath.Join("src", "app/server/server.js"),
},
Delete: map[string]string{},
},
Expand Down Expand Up @@ -257,7 +257,7 @@ func TestNewSyncItem(t *testing.T) {
expected: &Item{
Image: "test:123",
Copy: map[string]string{
filepath.Join("dir1", "dir2/node.js"): "dir1/dir2/node.js",
filepath.Join("dir1", "dir2/node.js"): filepath.Join("dir1", "dir2/node.js"),
},
Delete: map[string]string{},
},
Expand Down

0 comments on commit fb90748

Please sign in to comment.