fix(core): create root directory before extracting files

This fixes a bug where files in the root directory of an archive
would not be extracted if they are encountered before any other directory.
The reason is that QFile::open() cannot create directories.
This commit is contained in:
Oleg Shparber 2020-08-30 13:30:09 -04:00
parent bab39cd883
commit 803db6ae34

View File

@ -59,6 +59,9 @@ void Extractor::extract(const QString &sourceFile, const QString &destination, c
destinationDir.setPath(destinationDir.filePath(root));
}
// Destination directory must be created before any other files.
destinationDir.mkpath(QLatin1String("."));
// TODO: Do not strip root directory in archive if it equals to 'root'
archive_entry *entry;
while (archive_read_next_header(info.archiveHandle, &entry) == ARCHIVE_OK) {