From ecedcd060803ff01ca784814925ab60fa5f2db91 Mon Sep 17 00:00:00 2001 From: Tobias Kunicke Date: Mon, 17 Jul 2017 15:06:42 +0200 Subject: [PATCH] fix drone exec on windows with docker toolbox --- drone/exec/exec.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drone/exec/exec.go b/drone/exec/exec.go index 341ccbd..ccba856 100644 --- a/drone/exec/exec.go +++ b/drone/exec/exec.go @@ -7,6 +7,7 @@ import ( "os" "path" "path/filepath" + "runtime" "strings" "time" @@ -327,6 +328,15 @@ func exec(c *cli.Context) error { workspacePath = c.String("workspace-path") } dir, _ := filepath.Abs(filepath.Dir(file)) + + if runtime.GOOS == "windows" { + base := filepath.VolumeName(dir) + if len(base) == 2 { + dir = dir[2:] + base = strings.ToLower(base[:1]) + dir = "/" + base + filepath.ToSlash(dir) + } + } volumes = append(volumes, c.String("prefix")+"_default:"+workspaceBase) volumes = append(volumes, dir+":"+path.Join(workspaceBase, workspacePath)) }