mirror of
https://github.com/DarkStore-3DS/DarkStore.git
synced 2026-07-03 00:39:02 +00:00
Fix regex file names in extract
~~this code kinda sucks and should be redone~~
This commit is contained in:
@@ -51,15 +51,17 @@ Result extractArchive(std::string archivePath, std::string wantedFile, std::stri
|
|||||||
while (archive_read_next_header(a, &entry) == ARCHIVE_OK) {
|
while (archive_read_next_header(a, &entry) == ARCHIVE_OK) {
|
||||||
std::string entryName(archive_entry_pathname(entry));
|
std::string entryName(archive_entry_pathname(entry));
|
||||||
if (wantedFile == "/") wantedFile = "";
|
if (wantedFile == "/") wantedFile = "";
|
||||||
if (matchPattern(wantedFile, entryName.substr(0,wantedFile.length())) || wantedFile == "") {
|
if (matchPattern(wantedFile, entryName) || matchPattern(wantedFile, entryName.substr(0, wantedFile.size())) || wantedFile == "") {
|
||||||
extractingFile = (entryName.length() > wantedFile.length() ? entryName.substr(wantedFile.length()) : wantedFile);
|
extractingFile = (entryName.length() > wantedFile.length() ? entryName.substr(wantedFile.length()) : wantedFile);
|
||||||
ret = EXTRACT_ERROR_NONE;
|
ret = EXTRACT_ERROR_NONE;
|
||||||
|
|
||||||
Handle fileHandle;
|
Handle fileHandle;
|
||||||
std::string outputPathFinal = outputPath;
|
std::string outputPathFinal = outputPath;
|
||||||
if (entryName.length() > wantedFile.length())
|
if(wantedFile[wantedFile.length()-1] == '/') { // Folder
|
||||||
outputPathFinal += entryName.substr(wantedFile.length());
|
if (entryName.length() > wantedFile.length())
|
||||||
if (outputPathFinal.substr(outputPathFinal.length()-1) == "/") continue;
|
outputPathFinal += entryName.substr(wantedFile.length());
|
||||||
|
if (outputPathFinal.substr(outputPathFinal.length()-1) == "/") continue;
|
||||||
|
}
|
||||||
Result res = openFile(&fileHandle, outputPathFinal.c_str(), true);
|
Result res = openFile(&fileHandle, outputPathFinal.c_str(), true);
|
||||||
if (R_FAILED(res)) {
|
if (R_FAILED(res)) {
|
||||||
ret = EXTRACT_ERROR_OPENFILE;
|
ret = EXTRACT_ERROR_OPENFILE;
|
||||||
|
|||||||
Reference in New Issue
Block a user