From f66932c598d62979868138fedc3240656ed39825 Mon Sep 17 00:00:00 2001 From: Ben Cragg Date: Wed, 25 Apr 2018 11:52:57 +0100 Subject: [PATCH] Modified paths to work with Windows --- xgo.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/xgo.go b/xgo.go index b2bae9ce..3fa03d16 100644 --- a/xgo.go +++ b/xgo.go @@ -18,6 +18,7 @@ import ( "os/exec" "os/user" "path/filepath" + "regexp" "strconv" "strings" ) @@ -281,10 +282,16 @@ func compile(image string, config *ConfigFlags, flags *BuildFlags, folder string // Assemble and run the cross compilation command fmt.Printf("Cross compiling %s...\n", config.Repository) + // Alter paths so they work for Windows + // Does not affect Linux paths + re := regexp.MustCompile("([A-Z]):") + folder_w := filepath.ToSlash(re.ReplaceAllString(folder, "/$1")) + depsCache_w := filepath.ToSlash(re.ReplaceAllString(depsCache, "/$1")) + args := []string{ "run", "--rm", - "-v", folder + ":/build", - "-v", depsCache + ":/deps-cache:ro", + "-v", folder_w + ":/build", + "-v", depsCache_w + ":/deps-cache:ro", "-e", "REPO_REMOTE=" + config.Remote, "-e", "REPO_BRANCH=" + config.Branch, "-e", "PACK=" + config.Package,