pub fn extract(
source: &Path,
target: &Path,
options: &ExtractOptions,
warnings: &mut dyn WarningSink,
) -> Result<ExtractSummary, Error>Expand description
Extracts source into target.
source is a DayZ client or server folder, a mod folder or a single PBO. For a folder, every *.pbo
directly in its dta and addons subfolders (any case) is read, in sorted path order. The entries of
each PBO go to <target>/<prefix>/<entry>; an empty prefix means the file stem of the PBO. Names are
validated like crate::pbo::unpack does and unsafe ones are skipped with a warning. When two PBOs
write the same path (ignoring case), the later one wins and a duplicate-path warning names both. When
an entry would be a file where an earlier one has a folder, or the reverse, the first stays and the
later one is skipped with an extract-path-clash warning.
With options.derapify, a rapified *.bin becomes a .cpp of the same name, or stays a .bin with a
derapify-failed warning. options.only and options.exclude select entries like they do for
crate::pbo::unpack.
The tree is written to a staging folder next to target and then replaces it with one rename, so a
re-run drops files that no longer exist and a failure leaves the old tree alone. The file pbo-map.tsv
in the target has one line per PBO, prefix<TAB>path of the PBO relative to source with /
separators, sorted by prefix. The prefix is written with / instead of \ (like the tree below the target); then
\, TAB, CR and LF in either column are written as \\, \t, \r and \n, so every \ in the file starts
an escape. The bytes of the prefix as stored are in the --json output of inspect.
ยงErrors
Returns an error if the source has no PBO or cannot be read, a PBO is malformed or an entry is truncated
(its data ends past the end of the file), an entry cannot be read or decompressed, the target exists and
options.force is not set, the target is not a folder, is inside the source or contains it, the target
folder is neither empty nor the result of an earlier extract (no pbo-map.tsv), or the tree cannot be
written. A failure leaves an existing target alone.