github.com/lazyboychen7/engine@v17.12.1-ce-rc2+incompatible/builder/dockerfile/dispatchers_unix.go (about)

     1  // +build !windows
     2  
     3  package dockerfile
     4  
     5  import (
     6  	"errors"
     7  	"os"
     8  	"path/filepath"
     9  )
    10  
    11  // normalizeWorkdir normalizes a user requested working directory in a
    12  // platform semantically consistent way.
    13  func normalizeWorkdir(_ string, current string, requested string) (string, error) {
    14  	if requested == "" {
    15  		return "", errors.New("cannot normalize nothing")
    16  	}
    17  	current = filepath.FromSlash(current)
    18  	requested = filepath.FromSlash(requested)
    19  	if !filepath.IsAbs(requested) {
    20  		return filepath.Join(string(os.PathSeparator), current, requested), nil
    21  	}
    22  	return requested, nil
    23  }
    24  
    25  // equalEnvKeys compare two strings and returns true if they are equal. On
    26  // Windows this comparison is case insensitive.
    27  func equalEnvKeys(from, to string) bool {
    28  	return from == to
    29  }