...

Source file src/github.com/Microsoft/hcsshim/internal/longpath/longpath.go

Documentation: github.com/Microsoft/hcsshim/internal/longpath

     1  package longpath
     2  
     3  import (
     4  	"path/filepath"
     5  	"strings"
     6  )
     7  
     8  // LongAbs makes a path absolute and returns it in NT long path form.
     9  func LongAbs(path string) (string, error) {
    10  	if strings.HasPrefix(path, `\\?\`) || strings.HasPrefix(path, `\\.\`) {
    11  		return path, nil
    12  	}
    13  	if !filepath.IsAbs(path) {
    14  		absPath, err := filepath.Abs(path)
    15  		if err != nil {
    16  			return "", err
    17  		}
    18  		path = absPath
    19  	}
    20  	if strings.HasPrefix(path, `\\`) {
    21  		return `\\?\UNC\` + path[2:], nil
    22  	}
    23  	return `\\?\` + path, nil
    24  }
    25  

View as plain text