// +build windowspackagesystemimport("fmt""path/filepath""strings")// DefaultPathEnv is deliberately empty on Windows as the default path will be set by// the container. Docker has no context of what the default path should be.constDefaultPathEnv=""// CheckSystemDriveAndRemoveDriveLetter verifies and manipulates a Windows path.// This is used, for example, when validating a user provided path in docker cp.// If a drive letter is supplied, it must be the system drive. The drive letter// is always removed. Also, it translates it to OS semantics (IOW / to \). We// need the path in this syntax so that it can ultimately be contatenated with// a Windows long-path which doesn't support drive-letters. Examples:// C: --> Fail// C:\ --> \// a --> a// /a --> \a// d:\ --> FailfuncCheckSystemDriveAndRemoveDriveLetter(pathstring)(string,error){iflen(path)==2&&string(path[1])==":"{return"",fmt.Errorf("No relative path specified in %q",path)}if!filepath.IsAbs(path)||len(path)<2{returnfilepath.FromSlash(path),nil}ifstring(path[1])==":"&&!strings.EqualFold(string(path[0]),"c"){return"",fmt.Errorf("The specified path is not on the system drive (C:)")}returnfilepath.FromSlash(path[2:]),nil}