INNER CODE UNIT · Python
target
KSwordDEV/KSword · GhidraRuntimePlugin/package.py:86
target = destination.joinpath(*relative.parts)
# Output is exclusively newly created. No rename/delete/overwrite,
# no links; the relative path was checked before this extraction.
if entry.is_dir():
target.mkdir(parents=True, exist_ok=True)
continue
target.parent.mkdir(parents=True, exist_ok=True)
digest = hashlib.sha256()
count = 0
with archive.open(entry) as source, target.open('xb') as sink:
for block in iter(lambda: source.read(1024 * 1024), b''):
digest.update(block)
count += len(block)
sink.write(block)
if count != entry.file_size:
raise ValueError('extracted size mismatch')
os.utime(target, (315532800, 315532800))
inventory.append({'path': target.relative_to(output).as_posix(), 'bytes': count,