There has been problems with FSO
and relative paths. All documentation says, that paths can be either absolute or relative, but personally I never have got relative paths to work.
I'm using an installation folder -based addressing system in my local apps. A simplified version is something like this:
function getInstallBase() {
var defInstal = 'Application_installation_folder_name',
selfPath = window.location.pathname.replace(/\\/g,'/');
if (selfPath.charAt(0) === '/') { // *
selfPath = selfPath.substring(1, selfPath.length);
}
selfPath = selfPath.split(defInstal);
return selfPath[0] + defInstal + '/';
}
var defRoot = getInstallBase();
*
= IE returns /G:/... when HTA returns G:/...
defRoot
now contains an absolute path to the installation folder, no matter where it is saved.
Put this code to a JS-file in the installation folder of your application. Where ever you need a path, provide it based on defRoot
i.e. counted from the installation folder. In your case (assuming folder
is the installation folder) you can use it like this:
var s = fso.CreateTextFile(defRoot + 'annotations/annotate.xml', true);
I've used this technique for portable apps, and it works like a charm. You can make executable copies to memory sticks, CDs, DVDs, where ever you want, without need to touch the code at all.