Documentation
¶
Overview ¶
Package winpath maps the Win32 file namespace spelling of a local path to the ordinary one, so that path boundaries and permission rules compare one form.
\\?\D:\a\b.png names the same file as D:\a\b.png; it only tells Windows to skip path normalization. Tools such as Rust's fs::canonicalize and screenshot helpers print it, and models copy it. Go treats \\?\D: and D: as different volumes, so filepath.Rel between the two spellings fails.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNamespace = errors.New(`unsupported Windows path namespace; use an ordinary path such as D:\dir\file or \\server\share\file`)
ErrNamespace reports a Windows namespace spelling (\\.\, \??\, volume GUIDs, GLOBALROOT, ...) or an extended path that has no ordinary equivalent.
Functions ¶
func Normalize ¶
Normalize returns the ordinary spelling of an extended local path: \\?\x:\dir becomes X:\dir and \\?\UNC\server\share\dir becomes \\server\share\dir. Paths without a namespace prefix, and every path off Windows, come back unchanged. Device namespaces, volume paths, and extended paths whose meaning would change once Windows normalizes them (".", "..", "/", empty components, trailing dots or spaces, ":" streams, reserved device names) return ErrNamespace. Long paths need no prefix: the os package adds one itself.
Types ¶
This section is empty.