Skip to content
This repository has been archived by the owner on Feb 7, 2022. It is now read-only.

Modified paths to work with Windows #119

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions xgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"os/exec"
"os/user"
"path/filepath"
"regexp"
"strconv"
"strings"
)
Expand Down Expand Up @@ -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,
Expand Down