github.com/mheon/docker@v0.11.2-0.20150922122814-44f47903a831/pkg/longpath/longpath.go (about)

     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  
     5  package longpath
     6  
     7  import (
     8  	"strings"
     9  )
    10  
    11  // Prefix is the longpath prefix for Windows file paths.
    12  const Prefix = `\\?\`
    13  
    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  		path = Prefix + path
    19  	}
    20  	return path
    21  }