From 803db6ae34afb32bfa52ce1c0fed1df8f979ef74 Mon Sep 17 00:00:00 2001 From: Oleg Shparber Date: Sun, 30 Aug 2020 13:30:09 -0400 Subject: [PATCH] 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. --- src/libs/core/extractor.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libs/core/extractor.cpp b/src/libs/core/extractor.cpp index 3c121592e..275146f4c 100644 --- a/src/libs/core/extractor.cpp +++ b/src/libs/core/extractor.cpp @@ -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) {