2016-05-02 21:33:59 -04:00
|
|
|
// +build !windows
|
|
|
|
|
|
|
|
package dockerfile
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"path/filepath"
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
"github.com/docker/docker/pkg/system"
|
|
|
|
)
|
|
|
|
|
|
|
|
// normaliseDest normalises the destination of a COPY/ADD command in a
|
|
|
|
// platform semantically consistent way.
|
2017-05-25 17:03:29 -04:00
|
|
|
func normaliseDest(workingDir, requested string) (string, error) {
|
2016-05-02 21:33:59 -04:00
|
|
|
dest := filepath.FromSlash(requested)
|
|
|
|
endsInSlash := strings.HasSuffix(requested, string(os.PathSeparator))
|
|
|
|
if !system.IsAbs(requested) {
|
|
|
|
dest = filepath.Join(string(os.PathSeparator), filepath.FromSlash(workingDir), dest)
|
|
|
|
// Make sure we preserve any trailing slash
|
|
|
|
if endsInSlash {
|
|
|
|
dest += string(os.PathSeparator)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return dest, nil
|
|
|
|
}
|
2016-09-13 20:50:45 -04:00
|
|
|
|
|
|
|
func containsWildcards(name string) bool {
|
|
|
|
for i := 0; i < len(name); i++ {
|
|
|
|
ch := name[i]
|
|
|
|
if ch == '\\' {
|
|
|
|
i++
|
|
|
|
} else if ch == '*' || ch == '?' || ch == '[' {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
2017-05-07 14:37:46 -04:00
|
|
|
|
|
|
|
func validateCopySourcePath(imageSource *imageMount, origPath string) error {
|
|
|
|
return nil
|
|
|
|
}
|