Skip to content
Snippets Groups Projects
Commit 70f5fe96 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

js.exec() expects a full path to the script, normally

There's a weird issue where the scope-walk to find a "js.exec_dir" isn't
working (for Nick Young or Nightfox) after invoking DDMsgReader. This should
fix (or work around) that issue.

And js.exec() doesn't search the mods_dir first when a full script path isn't
passed, so with this change, child scripts that are in the mods_dir should now
work as a sysop would expect.
parent 68df9812
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
......@@ -195,7 +195,10 @@ while(bbs.online && !js.terminated) {
cmd = console.getstr();
if(cmd == '!')
cmd = last_str_cmd;
js.exec("str_cmds.js", {}, cmd);
var script = system.mods_dir + "str_cmds.js";
if(!file_exists(script))
script = system.exec_dir + "str_cmds.js";
js.exec(script, {}, cmd);
last_str_cmd = cmd;
continue;
}
......@@ -243,10 +246,13 @@ while(bbs.online && !js.terminated) {
if(menu_cmd.eval)
eval(menu_cmd.eval);
if(menu_cmd.exec) {
var script = system.mods_dir + menu_cmd.exec;
if(!file_exists(script))
script = system.exec_dir + menu_cmd.exec;
if(menu_cmd.args)
js.exec.apply(null, [menu_cmd.exec, {}].concat(menu_cmd.args));
js.exec.apply(null, [script, {}].concat(menu_cmd.args));
else
js.exec(menu_cmd.exec, {});
js.exec(script, {});
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment