7 Replies Latest reply on Feb 11, 2010 6:49 AM by Loic.Aigon

    [JS MAC] File path problem with special characters

    Loic.Aigon Adobe Community Professional

      Hello,

       

      I am trying to report a file 's path on a text file. One of the folders includes a special character such as "Loïc".

      So when I try to write a txt file with that path, it fails.

       

      Here is a snippet I have isolated for debugging.

       

      The problem appears on a Mac but may be present on a PC as well.

       

      //Considering an open file in Indesign

      //This file is placed within a subfolder named "Loïc"

      var theFile= File(app.activeDocument.fullName);
      var myFileFullName = theFile.fsName;
      var modifsArr = [];
      modifsArr.push(myFileFullName);
      var txtFile=File(Folder.desktop + "/test.txt");
      if(File(Folder.desktop + "/test.txt").exists ==false)
      {
          var txtFile=new File(Folder.desktop + "/test.txt");
      }

       

      txtFile.open("e");
      txtFile.seek(0,2);
      modifsArr = modifsArr.join("\r");
      theFile.write(modifsArr); //Here the writing fails
      theFile.close();

       

      How can I solve that ?

      TIA

      Loic