Skip to content
  • Rob Swindell's avatar
    9013f866
    Save and restore the js.exec_path, exec_dir, and exec_file properties · 9013f866
    Rob Swindell authored
    When invoking a nested JS script, these properties of the "js" object would
    be overwritten and not restored, as discovered/reported by Nightfox when his
    trivial game script would indirectly execute yesnobar.js, his subsequent use
    of js.exec_dir would point to the wrong location (the "exec" directory, parent
    of yesnobar.js, and not the direcctory where his game script was located).
    The exec_path and exec_file properties had the same problem as demonstrated
    by a simple test.js placed in (and executed from) a directory other than the
    "exec" dir:
    	function f() {
            print("js.exec_path = " + js.exec_path);
            print("js.exec_dir = " + js.exec_dir);
            print("Js.exec_file = " + js.exec_file);
    	}
    	f();
    	console.yesno("test");
    	f();
    
    This would only trigger the problem when executed from the BBS and whebn the
    YesNoQuestion text.dat string invokes the "yesnobar" module via EXEC @-code and
    yesnobar.js exists (in exec or mods dir), superceding yesnobar.bin which does
    not trigger this issue (not a JavaScript mod).
    9013f866
    Save and restore the js.exec_path, exec_dir, and exec_file properties
    Rob Swindell authored
    When invoking a nested JS script, these properties of the "js" object would
    be overwritten and not restored, as discovered/reported by Nightfox when his
    trivial game script would indirectly execute yesnobar.js, his subsequent use
    of js.exec_dir would point to the wrong location (the "exec" directory, parent
    of yesnobar.js, and not the direcctory where his game script was located).
    The exec_path and exec_file properties had the same problem as demonstrated
    by a simple test.js placed in (and executed from) a directory other than the
    "exec" dir:
    	function f() {
            print("js.exec_path = " + js.exec_path);
            print("js.exec_dir = " + js.exec_dir);
            print("Js.exec_file = " + js.exec_file);
    	}
    	f();
    	console.yesno("test");
    	f();
    
    This would only trigger the problem when executed from the BBS and whebn the
    YesNoQuestion text.dat string invokes the "yesnobar" module via EXEC @-code and
    yesnobar.js exists (in exec or mods dir), superceding yesnobar.bin which does
    not trigger this issue (not a JavaScript mod).
Loading