*Only* open valid Scripts.
This commit is contained in:
parent
11e7664706
commit
3ebdb7e95d
5 changed files with 29 additions and 15 deletions
|
|
@ -131,4 +131,18 @@ void ScriptHelper::displayTimeMsg(std::string message, int seconds) {
|
|||
for (int i = 0; i < 60*seconds; i++) {
|
||||
gspWaitForVBlank();
|
||||
}
|
||||
}
|
||||
|
||||
bool ScriptHelper::checkIfValid(std::string scriptFile) {
|
||||
FILE* file = fopen(scriptFile.c_str(), "rt");
|
||||
if(!file) {
|
||||
printf("File not found\n");
|
||||
return false;
|
||||
}
|
||||
nlohmann::json json = nlohmann::json::parse(file, nullptr, false);
|
||||
fclose(file);
|
||||
|
||||
if (!json.contains("info")) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue