1
0
Fork 0

Codechange: use string comparision for ConExec's second parameter

pull/14093/head
Rubidium 2025-04-23 20:42:29 +02:00 committed by rubidium42
parent a01d47b333
commit ddc0d6ead3
1 changed files with 3 additions and 2 deletions

View File

@ -1133,7 +1133,8 @@ static bool ConNetworkConnect([[maybe_unused]] uint8_t argc, [[maybe_unused]] ch
static bool ConExec([[maybe_unused]] uint8_t argc, [[maybe_unused]] char *argv[])
{
if (argc == 0) {
IConsolePrint(CC_HELP, "Execute a local script file. Usage: 'exec <script> <?>'.");
IConsolePrint(CC_HELP, "Execute a local script file. Usage: 'exec <script> [0]'.");
IConsolePrint(CC_HELP, "By passing '0' after the script name, no warning about a missing script file will be shown.");
return true;
}
@ -1142,7 +1143,7 @@ static bool ConExec([[maybe_unused]] uint8_t argc, [[maybe_unused]] char *argv[]
auto script_file = FioFOpenFile(argv[1], "r", BASE_DIR);
if (!script_file.has_value()) {
if (argc == 2 || atoi(argv[2]) != 0) IConsolePrint(CC_ERROR, "Script file '{}' not found.", argv[1]);
if (argc == 2 || strcmp(argv[2], "0") != 0) IConsolePrint(CC_ERROR, "Script file '{}' not found.", argv[1]);
return true;
}