mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
9b648dfac6
Signed-off-by: Stefan J. Wernli <swernli@microsoft.com>
21 lines
577 B
Go
21 lines
577 B
Go
// 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
|
|
}
|