github.com/rish1988/moby@v25.0.2+incompatible/pkg/containerfs/containerfs.go (about)

     1  package containerfs // import "github.com/docker/docker/pkg/containerfs"
     2  
     3  import "path/filepath"
     4  
     5  // CleanScopedPath prepares the given path to be combined with a mount path or
     6  // a drive-letter. On Windows, it removes any existing driveletter (e.g. "C:").
     7  // The returned path is always prefixed with a [filepath.Separator].
     8  func CleanScopedPath(path string) string {
     9  	if len(path) >= 2 {
    10  		if v := filepath.VolumeName(path); len(v) > 0 {
    11  			path = path[len(v):]
    12  		}
    13  	}
    14  	return filepath.Join(string(filepath.Separator), path)
    15  }