]> git.immae.eu Git - github/fretlink/terraform-provider-statuscake.git/blame - vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/longpath/longpath.go
provider: Ensured Go 1.11 in TravisCI and README
[github/fretlink/terraform-provider-statuscake.git] / vendor / github.com / fsouza / go-dockerclient / external / github.com / docker / docker / pkg / longpath / longpath.go
CommitLineData
9b12e4fe
JC
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.
4
5package longpath
6
7import (
8 "strings"
9)
10
11// Prefix is the longpath prefix for Windows file paths.
12const Prefix = `\\?\`
13
14// AddPrefix will add the Windows long path prefix to the path provided if
15// it does not already have it.
16func 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:]
21 } else {
22 path = Prefix + path
23 }
24 }
25 return path
26}