github.com/jiasir/docker@v1.3.3-0.20170609024000-252e610103e7/builder/dockerfile/dispatchers_unix.go (about) 1 // +build !windows 2 3 package dockerfile 4 5 import ( 6 "errors" 7 "fmt" 8 "os" 9 "path/filepath" 10 ) 11 12 // normaliseWorkdir normalises a user requested working directory in a 13 // platform semantically consistent way. 14 func normaliseWorkdir(current string, requested string) (string, error) { 15 if requested == "" { 16 return "", errors.New("cannot normalise nothing") 17 } 18 current = filepath.FromSlash(current) 19 requested = filepath.FromSlash(requested) 20 if !filepath.IsAbs(requested) { 21 return filepath.Join(string(os.PathSeparator), current, requested), nil 22 } 23 return requested, nil 24 } 25 26 func errNotJSON(command, _ string) error { 27 return fmt.Errorf("%s requires the arguments to be in JSON form", command) 28 } 29 30 // equalEnvKeys compare two strings and returns true if they are equal. On 31 // Windows this comparison is case insensitive. 32 func equalEnvKeys(from, to string) bool { 33 return from == to 34 }