Windows: Fix long path handling for docker build

Signed-off-by: Stefan J. Wernli <swernli@microsoft.com>
This commit is contained in:
Stefan J. Wernli 2015-08-24 14:07:22 -07:00
parent 5bebf3cbac
commit fe637416e9
9 changed files with 214 additions and 10 deletions

21
longpath/longpath.go Normal file
View file

@ -0,0 +1,21 @@
// longpath introduces some constants and helper functions for handling long paths
// in Windows, which are expected to be prepended with `\\?\` and followed by either
// a drive letter, a UNC server\share, or a volume identifier.
package longpath
import (
"strings"
)
// Prefix is the longpath prefix for Windows file paths.
const Prefix = `\\?\`
// AddPrefix will add the Windows long path prefix to the path provided if
// it does not already have it.
func AddPrefix(path string) string {
if !strings.HasPrefix(path, Prefix) {
path = Prefix + path
}
return path
}