That means I don't have the following objects:
I already figured a few things out:
Since you can use slash (/) instead of a backslash () in a path and you don't need to escape a slash, I'll try to work with / ... I also figured it would be best to remove the trailing slash if there is one.
So here are a couple of things I already figured out:
var currentDir = new ActiveXObject("WScript.Shell").CurrentDirectory.replace(/\\/g, '/'); //current directory with slashes var root = currentDir.substring(0,2) //e.g. C: or D: (without trailing slash)
There are a couple of of different relative pathes that have to be converted correctly. Just to make sure, here are some examples:
If the script was launched from
C:\folder1\folder2\folder3 the paths should be converted accordingly:
D:/folder/another folder/file.js/../../other file.js =>
And yeah.. I'm kind of stuck here. I guess this requires some kind of parsing loop, but I just couldn't come up with the solution.
I hope you can help me out here. :/