mirror of
https://github.com/DarkStore-3DS/DarkStore.git
synced 2026-07-03 00:39:02 +00:00
Say "failed", not "succeeded" if extract fails
This commit is contained in:
@@ -38,7 +38,8 @@ enum ScriptState {
|
||||
SYNTAX_ERROR,
|
||||
COPY_ERROR,
|
||||
MOVE_ERROR,
|
||||
DELETE_ERROR
|
||||
DELETE_ERROR,
|
||||
EXTRACT_ERROR
|
||||
};
|
||||
|
||||
namespace ScriptUtils {
|
||||
@@ -52,7 +53,7 @@ namespace ScriptUtils {
|
||||
Result downloadRelease(const std::string &repo, const std::string &file, const std::string &output, bool includePrereleases, const std::string &message, bool isARG = false);
|
||||
Result downloadFile(const std::string &file, const std::string &output, const std::string &message, bool isARG = false);
|
||||
void installFile(const std::string &file, bool updatingSelf, const std::string &message, bool isARG = false);
|
||||
void extractFile(const std::string &file, const std::string &input, const std::string &output, const std::string &message, bool isARG = false);
|
||||
Result extractFile(const std::string &file, const std::string &input, const std::string &output, const std::string &message, bool isARG = false);
|
||||
|
||||
Result runFunctions(nlohmann::json storeJson, int selection, const std::string &entry);
|
||||
};
|
||||
|
||||
@@ -65,6 +65,7 @@
|
||||
"EXECUTE_ENTRY": "Would you like to execute this entry?",
|
||||
"EXIT_APP": "Exit Universal-Updater",
|
||||
"EXTRACTING": "Extracting... %s / %s (%.2f%%)",
|
||||
"EXTRACT_ERROR": "Extract error!",
|
||||
"FEATURE_SIDE_EFFECTS": "This Feature may have side effects while the Queue is running.\nAre you sure you want to continue?",
|
||||
"FETCHING_METADATA": "Fetching old metadata...",
|
||||
"FETCHING_RECOMMENDED_UNISTORES": "Fetching recommended UniStores...",
|
||||
|
||||
@@ -108,10 +108,9 @@ void QueueSystem::QueueHandle() {
|
||||
queueEntries[0]->total = queueEntries[0]->obj.size();
|
||||
queueEntries[0]->current = QueueSystem::LastElement;
|
||||
|
||||
for(int i = QueueSystem::LastElement; (ret != PROMPT_RET) && i < queueEntries[0]->total; i++) {
|
||||
for(int i = QueueSystem::LastElement; ret == NONE && i < queueEntries[0]->total && !QueueSystem::CancelCallback; i++) {
|
||||
queueEntries[0]->current++;
|
||||
|
||||
if (ret == NONE && !QueueSystem::CancelCallback) {
|
||||
std::string type = "";
|
||||
|
||||
if (queueEntries[0]->obj[i].contains("type") && queueEntries[0]->obj[i]["type"].is_string()) {
|
||||
@@ -195,7 +194,7 @@ void QueueSystem::QueueHandle() {
|
||||
output = queueEntries[0]->obj[i]["output"];
|
||||
} else missing = true;
|
||||
|
||||
if (!missing) ScriptUtils::extractFile(file, input, output, "", false);
|
||||
if (!missing) ret = ScriptUtils::extractFile(file, input, output, "", false);
|
||||
else ret = SYNTAX_ERROR;
|
||||
|
||||
/* Installing CIAs. */
|
||||
@@ -338,12 +337,6 @@ void QueueSystem::QueueHandle() {
|
||||
|
||||
if (skipCount > 0) i += skipCount; // Skip.
|
||||
}
|
||||
|
||||
} else {
|
||||
queueEntries[0]->current = queueEntries[0]->total; // Set to total.
|
||||
ret = SCRIPT_CANCELED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* If we expect a prompt, we go to this. */
|
||||
|
||||
@@ -276,8 +276,9 @@ void ScriptUtils::installFile(const std::string &file, bool updatingSelf, const
|
||||
}
|
||||
|
||||
/* Extract files. */
|
||||
void ScriptUtils::extractFile(const std::string &file, const std::string &input, const std::string &output, const std::string &message, bool isARG) {
|
||||
Result ScriptUtils::extractFile(const std::string &file, const std::string &input, const std::string &output, const std::string &message, bool isARG) {
|
||||
extractFilesCount = 0;
|
||||
Result ret = NONE;
|
||||
|
||||
std::string out, in;
|
||||
in = std::regex_replace(file, std::regex("%ARCHIVE_DEFAULT%"), config->archPath());
|
||||
@@ -305,13 +306,17 @@ void ScriptUtils::extractFile(const std::string &file, const std::string &input,
|
||||
filesExtracted = 0;
|
||||
|
||||
getExtractedSize(in, input);
|
||||
extractArchive(in, input, out);
|
||||
if(extractArchive(in, input, out) != EXTRACT_ERROR_NONE) {
|
||||
ret = EXTRACT_ERROR;
|
||||
}
|
||||
|
||||
if (isARG) {
|
||||
showProgressBar = false;
|
||||
threadJoin(thread, U64_MAX);
|
||||
threadFree(thread);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -442,7 +447,7 @@ Result ScriptUtils::runFunctions(nlohmann::json storeJson, int selection, const
|
||||
message = Script[i]["message"];
|
||||
}
|
||||
|
||||
if (!missing) ScriptUtils::extractFile(file, input, output, message, true);
|
||||
if (!missing) ret = ScriptUtils::extractFile(file, input, output, message, true);
|
||||
else ret = SYNTAX_ERROR;
|
||||
|
||||
} else if (type == "installCia") {
|
||||
@@ -580,5 +585,6 @@ Result ScriptUtils::runFunctions(nlohmann::json storeJson, int selection, const
|
||||
else if (ret == COPY_ERROR) Msg::waitMsg(Lang::get("COPY_ERROR"));
|
||||
else if (ret == MOVE_ERROR) Msg::waitMsg(Lang::get("MOVE_ERROR"));
|
||||
else if (ret == DELETE_ERROR) Msg::waitMsg(Lang::get("DELETE_ERROR"));
|
||||
else if (ret == EXTRACT_ERROR) Msg::waitMsg(Lang::get("EXTRACT_ERROR"));
|
||||
return ret;
|
||||
}
|
||||
Reference in New Issue
Block a user