Check user input for the "/runmacro" command

Presents users from specifying a file path, and looking up macros in the 
expected folder.
This commit is contained in:
TheMatt2 2022-01-03 21:40:07 -08:00
parent 73718fe9af
commit f2b3b0bf66

View File

@ -611,6 +611,10 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
if (chatCommand == "runmacro" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER) {
if (args.size() != 1) return;
// Only process if input does not contain separator charaters
if (args[0].find("/") != std::string::npos) return;
if (args[0].find("\\") != std::string::npos) return;
std::ifstream infile("./res/macros/" + args[0] + ".scm");
if (infile.good()) {