Skip to content
Snippets Groups Projects
Commit 1a20872c authored by deuce's avatar deuce
Browse files

Use try/throw/catch plus the Spidermonkey Error.fileName extension to get

the startup path.
parent d1739e45
No related branches found
No related tags found
No related merge requests found
......@@ -2,5 +2,5 @@ function fname(name)
{
if(name.search(/^(?:[A-Z]:)?[\/\\]/)!=-1)
return(name);
return("../xtrn/tw2/"+name);
return(startup_path+name);
}
var startup_path='.';
try { throw new Error() } catch(e) { startup_path=e.fileName }
startup_path=startup_path.replace(/\/[^\/]*$/,'');
startup_path=backslash(startup_path);
load("recordfile.js");
load("lockfile.js");
load("../xtrn/tw2/filename.js");
load(startup_path+"filename.js");
load(fname("gamesettings.js"));
var Settings=new GameSettings();
......
load("../xtrn/tw2/filename.js");
var startup_path='.';
try { throw new Error() } catch(e) { startup_path=e.fileName }
startup_path=startup_path.replace(/\/[^\/]*$/,'');
startup_path=backslash(startup_path);
load(startup_path+"filename.js");
load(fname("gamesettings.js"));
load(fname("sector_map.js"));
load(fname("ports_map.js"));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment