sanitizePath

fnstring sanitizePath(string path, bool allowTraversal = false)

Sanitize a path for archive use.

Normalizes path separators and validates safety. On Windows, also checks for reserved device names.

Parameters

pathThe path to sanitize.
allowTraversalWhether to allow ".." components.

Returns

The sanitized path.

Throws

ArchiveError with PATH_ERROR if the path is unsafe.