sanitizePath

fnstring sanitizePath(string path, bool allowTraversal = false)

Sanitize a path for archive use.

Normalizes path separators and validates safety, including Windows reserved device names (archive entries are cross-platform data, so the reserved-name check runs on every platform).

Parameters

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

Returns

The sanitized path.

Throws

ArchiveError with PATH_ERROR if the path is unsafe.