Hello,

I am trying to find a way to reliably get the path to currently
executing script file, from within that same file. Reason for that is
I want to access some other files that I know are in the same
directory as the script file, but I can't predict what the current
working directory will be when my script is run.

Put another way, if I run my script like so:

$ java -jar js.jar ./stuff/myScript.js

or perhaps I run the same file like so:

$ java -jar js.jar ../yada/blah/stuff/myScript.js

or any other possible way, how can I get some code inside myScript.js
to know the path to itself. Like this pseudo code:

var thisDir = getDirOfThisScript();
load(thisDir+"/sisterFile.js");

Any help would be gratefully received.

Regards,
Michael
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to