mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
669c067798
This is a work base to introduce more features like build time dockerfile optimisations, dependency analysis and parallel build, as well as a first step to go from a dispatch-inline process to a frontend+backend process. Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>
29 lines
762 B
Go
29 lines
762 B
Go
// +build !windows
|
|
|
|
package dockerfile
|
|
|
|
import (
|
|
"errors"
|
|
"os"
|
|
"path/filepath"
|
|
)
|
|
|
|
// normalizeWorkdir normalizes a user requested working directory in a
|
|
// platform semantically consistent way.
|
|
func normalizeWorkdir(_ string, current string, requested string) (string, error) {
|
|
if requested == "" {
|
|
return "", errors.New("cannot normalize nothing")
|
|
}
|
|
current = filepath.FromSlash(current)
|
|
requested = filepath.FromSlash(requested)
|
|
if !filepath.IsAbs(requested) {
|
|
return filepath.Join(string(os.PathSeparator), current, requested), nil
|
|
}
|
|
return requested, nil
|
|
}
|
|
|
|
// equalEnvKeys compare two strings and returns true if they are equal. On
|
|
// Windows this comparison is case insensitive.
|
|
func equalEnvKeys(from, to string) bool {
|
|
return from == to
|
|
}
|