Skip to main content

Module windows_path

Module windows_path 

Source
Expand description

Windows extended-length (\\?\ verbatim) path semantics, owned in one place so the \\?\ / \\?\UNC\ prefix rules live at a single source of truth.

Two paired directions:

  • strip_windows_verbatim_prefix removes the prefix so a canonicalized path parses under normal Windows rules (and can re-enter /-joining code, or prefix-match a plain C:\ mount point). It is pure string logic and cross-platform: a well-formed absolute path off Windows never carries the prefix, so callers on any platform may normalize a Windows-shaped string through it.
  • [wide_maybe_verbatim] adds the prefix to a MoveFileExW operand so a durable write survives a path longer than the legacy 260-char MAX_PATH. It mirrors the standard library’s conservative maybe_verbatim rules and is Windows-only.

Functions§

strip_windows_verbatim_prefix
Strip a Windows verbatim (\\?\) prefix from a path string: \\?\UNC\server\share -> \\server\share, \\?\C:\dir -> C:\dir. Inputs without the prefix — every well-formed Unix path, plain Windows paths, and \\.\ device paths — are returned unchanged.