Skip to main content

unpack

Function unpack 

Source
pub fn unpack<I: Read>(
    input: &mut I,
    target: &Path,
    options: &UnpackOptions,
    warnings: &mut dyn WarningSink,
) -> Result<(), Error>
Expand description

Unpacks a PBO into the target folder.

Entry names and the prefix come from the (untrusted) PBO: entries whose name does not map to a safe relative path, that would be written through a symlink, or that collide (case-insensitively) with an entry already written in this run are skipped with a warning. Leading separators are stripped from a name (leading-separator warning). With options.use_prefix the files are extracted into <target>/<prefix>/; an empty prefix means no prefix. options.only and options.exclude select the entries to write ($PBOPREFIX$ is always written).

ยงErrors

Returns an error if the PBO cannot be read, the prefix is unsafe with use_prefix, or, without options.force, a selected file of the PBO (or $PBOPREFIX$) already exists in the target. That check covers the selected entries plus $PBOPREFIX$ and runs before anything is written, so a conflict leaves the target untouched.