Indesign convert URI to Windows format
Indesign jsx seems to be a bit more advanced than it's Photoshop sibling, which is what I'm used to.
Is there a quick one liner to make a filepath into a nice Windows one? ie
Turn
C:\\some%20folder/anotherFolder\\somefile.txt
into
C:\some folder\anotherFolder\somefile.txt
Without having to rely on regex to fix each thing (unifided slashes, %20, etc) as you go?
var afileName = "C:\\some%20folder/anotherFolder\\somefile.txt"
// var resolvedPath = resolve(afileName);
// var normalizedPath = path.normalize(afileName );
var nicePath = decodeURIComponent(afileName);
// Replace all front slashes with back slashes. We are Windows
nicePath = nicePath.replace(/\//g, "\\");
// replace %20 with space
// nicePath = nicePath.replace(/%20/g," ");
alert(nicePath);
