1 // longpath introduces some constants and helper functions for handling long paths
2 // in Windows, which are expected to be prepended with `\\?\` and followed by either
3 // a drive letter, a UNC server\share, or a volume identifier.
11 // Prefix is the longpath prefix for Windows file paths.
14 // AddPrefix will add the Windows long path prefix to the path provided if
15 // it does not already have it.
16 func AddPrefix(path string) string {
17 if !strings.HasPrefix(path, Prefix) {
18 if strings.HasPrefix(path, `\\`) {
19 // This is a UNC path, so we need to add 'UNC' to the path as well.
20 path = Prefix + `UNC` + path[1:]