Over in bug 835552, I'm trying to change the behavior of relative path lookups.
Current behavior: - load("foo/bar.js") will search relative to the current working directory - read("foo/bar.txt") will search relative to the calling script's filename on XP_UNIX (and relative to the current working directory on non-XP_UNIX, but ignore that for now.) To me, that seems backwards. I want to be able to be able to have a directory of scripts that load each other, so load() needs to be caller-relative. And the actual reason I'm doing something with this is because I want to be able to do system("something > tmp.txt"); load("tmp.txt") and have it find the file. It would also be nice to be able to run js ~/scripts/process.js somefile.txt (where process.js calls read(arguments[0])) and have the JS shell resolve the path the same way that bash would -- ie, relative to the cwd. But there are uses for the current behavior. I've added a readRelativeToScript() so you can have data files alongside scripts. Now in https://bugzilla.mozilla.org/show_bug.cgi?id=835552#c15 njn argues that the current cwd-relative behavior of load() should be the default and there should be a loadRelativeToScript() available. Note that probably a better solution would be to implement some basic path manipulation routines and perhaps a nicer way to get the current script's filename, but I've already scope-creeped this and this question is really about the default behavior. Opinions? _______________________________________________ dev-tech-js-engine-internals mailing list dev-tech-js-engine-internals@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals