funcsafe_relative#

safe_relative(
name: str,
) → str#

Reject archive paths that could escape the target directory.

Parameters:

name (str) – The path inside a modpack.

Returns:

The normalized path, with forward slashes.

Raises:

PackError – The path is absolute or could leave the directory.

Return type:

str