Expand description
Format-aware path parsing — replaces std::path::Path for cross-platform correctness.
std::path::Path uses the host OS’s path rules, which gives wrong results when
parsing POSIX paths on Windows or vice versa. These functions use the path’s
PathFormat to determine separator handling.
Functions§
- extension
- Get the extension (last “.ext” including the dot).
- extension_
no_ dot - Get the extension without the dot (for compatibility with std::path).
- file_
name - Get the file name (last component after the last separator).
- file_
stem - Get the file stem (file_name without the last extension).
- join_
pathlib - Join path parts using Python pathlib constructor semantics.
- parent
- Get the parent (everything before the last separator). Returns the path itself if there’s no parent (like “/” returns “/”).
- parts
- Split a path into its components (like Python’s PurePath.parts).
- pathlib_
normalize - Canonicalize a filesystem path the same way Python’s
pathlibdoes on construction. - sep
- Get the canonical separator for the given format.
- split
- Split a path into (parent, file_name), matching pathlib behavior.
- suffixes
- Get all suffixes (like Python’s PurePath.suffixes). “file.tar.gz” → [“.tar”, “.gz”] Get all suffixes (extensions) of the file name.