Skip to content

Commit

Permalink
fix(core): create root directory before extracting files
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
trollixx committed Aug 30, 2020
1 parent bab39cd commit 803db6a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/libs/core/extractor.cpp
Expand Up @@ -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) {
Expand Down

0 comments on commit 803db6a

Please sign in to comment.