Expand description
Opening an archive for extraction and working out whether it fits. Shared by the command line and the GUI, so the two never disagree.
Structs§
- Space
Plan - Whether an extraction fits, in the numbers a person needs to decide.
Enums§
Functions§
- begin
- Commits to a fresh extraction: saves the archive’s tail and writes the
journal. From here on the archive may be truncated, unless
keep_archiveis set, in which case nothing ever changes it. Files in the way (seeexisting) are refused unlessreplaceis given; then the run moves them aside before it extracts anything, and once it is complete deletes them or puts back the ones the choices keep. - check_
output - The journal lies next to the archive, where anyone who supplied the
archive could have put one, so it is used only for an extraction this
computer recorded starting into that folder (see [
crate::chosen]), or when the person names the folder again (given). A resume deletes what it finds at the paths of the entries left, so a planted journal could otherwise have it delete and write files anywhere, and even in the default folder it would replace the person’s own files there.commandis the one to run again, with-o. - clear_
uncommitted - Before continuing a crashed run, deletes what it wrote for batches it never committed.
- default_
output game.zip,game.7z.001,game.tar.gzandgame.part1.rarall extract intogame, next to them.- display_
name game.zip, orgame.7z.001 (+4 more parts)for a split archive.- existing
- The files and links already in
outat paths the archive extracts to, relative toout. A fresh extraction may only replace them when asked to; seebegin. When there are any, what would keep them from being replaced is refused here, before a front end asks. - keeps_
archive - Whether the extraction of a half-extracted archive keeps it, given what the person asked for now. The journal decides: an extraction that keeps the archive goes on keeping it, and one that has already removed part of it can’t start keeping it.
- locate
- The first volume of the archive and where its journal lives. Paths are made absolute so a resume works from any directory.
- open
writableis false for anything that only looks, so it works on read-only media and never takes the lock. For a fresh extraction the output folder may already hold other files, but no folder where the archive has a file or the other way round; files the archive would replace are listed byexisting.passwordonly matters for encrypted archives; seeopen_encryptedfor the ask-and-retry loop front ends want. What opening reads is counted inreads, which a front end can show from another thread: a compressed tar is read in full here.- open_
encrypted - Opens an archive that may be encrypted.
askis called whenever a password is needed or the last one was wrong, and returnsNoneto give up. Archives with a password are proven withJob::check_passwordbefore this returns, so nothing is deleted on a wrong guess. Returns the state and the password that worked. - open_
encrypted_ noting open_encrypted, callingslowwith a file and its size before a password check that decodes all of it (seeJob::slow_password_check), so a front end can say it may take a while.- plan
- The space plan for extracting
jobintoout, keeping the archive or not. For a half-extracted archive,keep_archivemust be what its journal says; seekeeps_archive. - retarget
- Moves a fresh extraction opened writable by
opento another folder, checking it asopenchecks the one it was given. - single_
root - Whether everything in the archive sits under one name at its top, one folder or a single file. “Extract here” puts such an archive next to itself; anything else would scatter loose files, so it gets a folder.