views:

78

answers:

0

Hi All,

i have the following snippet of xml that should point to a file.

    <pathurl>file:///E:/P2%20Cards/16-11-08/Scenes1/Reel58/CONTENTS/VIDEO/1061MK.MXF</pathurl>

and that is taken in by a script including a whole lot of other information into after effects in what is in Extendscript/javascript.. the following is the code that im currently having a problem with.

function coerceURI(path){
    var fileToImport = new File(pathurl);
    //$.writeln(fileToImport);
    if(fileToImport.exists){
     return fileToImport;
    }else{
      //try volumes first
      var pathurl = new String(path);
      //$.writeln(pathurl);
      if(pathurl.indexOf('/Volumes') != -1){
        //$.writeln('uses volumes');
        pathurl = pathurl.substring(pathurl.indexOf('/Volumes'), pathurl.length);
        //$.writeln(pathurl);
        var fileToImport = new File(pathurl);
        if(fileToImport.exists){
          //$.writeln('exists');
          return fileToImport;
        }else{

     return 'placeholder';
    }

  //then localhost
  }else if(pathurl.indexOf('localhost') != -1){

    pathurl = pathurl.substring(pathurl.indexOf('localhost') + 9, pathurl.length);//9 is localhost length - 1

    var fileToImport = new File(pathurl);

    if(fileToImport.exists){
      //$.writeln('exists');
      return fileToImport;
    }else{
     return 'placeholder';
    }
   //finally placeholder
  }else{

   return 'placeholder';
  }
}

on windows XP it relinks the file fine, But on Vista 32 and 64 bit it puts in "placeholder" because the fileToImport.exists evaluates to false. Anybody have any ideas? the xml file that gets passed in just evaluates to /e/path/file.xml but ive tried that without much success.

I have a script that modifies the XML that gets passed to this script so i can change the URI given. But im a little annoyed that a "Universal Resource whatever" isnt being recognised.

Any help would be great.

Cheers

Mark