check for windows style pathing with a regex

pull/9263/head
Sharif Elgamal 2020-09-17 12:15:54 -07:00
parent 23e7989c07
commit 39ae4fbdd2
1 changed files with 4 additions and 3 deletions

View File

@ -20,7 +20,7 @@ import (
"errors"
"fmt"
"path"
"runtime"
"regexp"
"strings"
)
@ -108,11 +108,12 @@ type Mount struct {
func ParseMountString(spec string) (m Mount, err error) {
f := strings.Split(spec, ":")
fields := f
if runtime.GOOS == "windows" {
windows, _ := regexp.MatchString(`^[A-Z]:\\*`, spec)
if windows {
// Recreate the host path that got split above since
// Windows paths look like C:\path
hpath := fmt.Sprintf("%s:%s", f[0], f[1])
fields = append(fields, hpath)
fields = []string{hpath}
fields = append(fields, f[2:]...)
}
switch len(fields) {