Skip to content

Commit

Permalink
remove redundant directory creating during extraction
Browse files Browse the repository at this point in the history
  • Loading branch information
HamletDuFromage committed Aug 7, 2022
1 parent 81913f6 commit 16fe8ff
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions source/extract.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <filesystem>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <ranges>
#include <set>
Expand Down Expand Up @@ -70,15 +69,12 @@ namespace extract {
}
}

void extractEntry(std::string filename, unzFile& zfile, bool forceCreateTree = false)
void extractEntry(std::string filename, unzFile& zfile)
{
if (filename.back() == '/') {
fs::createTree(filename);
return;
}
if (forceCreateTree) {
fs::createTree(filename);
}
void* buf = malloc(WRITE_BUFFER_SIZE);
FILE* outfile;
outfile = fopen(filename.c_str(), "wb");
Expand Down Expand Up @@ -265,7 +261,7 @@ namespace extract {
if (std::find_if(titles.begin(), titles.end(), [&filename, offset](std::string title) {
return caselessCompare((title.substr(0, 13)), filename.substr(offset, 13));
}) != titles.end()) {
extractEntry(filename, zfile, true);
extractEntry(filename, zfile);
}
}
}
Expand Down

0 comments on commit 16fe8ff

Please sign in to comment.