tar: Implement usage of prefixes when extracting

This commit is contained in:
Tim Schumacher 2021-11-21 19:56:48 +01:00 committed by Andreas Kling
parent 07351762c7
commit 0d679bf348
Notes: sideshowbarker 2024-07-18 00:52:57 +09:00

View File

@ -76,7 +76,13 @@ int main(int argc, char** argv)
Archive::TarFileStream file_stream = tar_stream.file_contents();
const Archive::TarFileHeader& header = tar_stream.header();
String absolute_path = Core::File::absolute_path(header.filename());
LexicalPath path = LexicalPath(header.filename());
if (!header.prefix().is_empty())
path = path.prepend(header.prefix());
String absolute_path = Core::File::absolute_path(path.string());
switch (header.type_flag()) {
case Archive::TarFileType::NormalFile:
case Archive::TarFileType::AlternateNormalFile: {