4 Replies Latest reply on May 28, 2017 11:53 AM by fullflash

    Creation and Modification dates for android file system

    l33tian Level 1

      Hello all, I am working on a project and i noticed a particular scenario where i'm getting an error everytime i try to run the code below on my android device;

       

       

                      var file:File=File.applicationDirectory.resolvePath("amf.js");
                      var modDate:Date;
                      var createDate:Date;
      
                       if(file.exists)
                       {
                              try
                              {
                                         modDate=file.modificationDate;
                                         credDate=file.creationDate;
                                         trace("Modification date: "+ modDate.toString()+"\nCreation date: "+credDate.toString());
                               }
                               catch(e:Error)
                               {
                                        trace(e.message+": Somehow android OS CANNOT READ mODIFICATRION AND CREATING DATES FOR FILES");
                               }
      
                      }
      
      

       

      Every time i run this on Adobe AIR's Mobile emulator, the correct dates are show up properly(Possibly because the emulator is running on Windows) but when i switch the debug to the device, the statement in the catch block executes. The real error says "Error #3003: File or directory does not exist."

       

      Am i missing something or is this a normal behaviour which i have to find a work around for? The modificationDate and the creationDate are all properties of the FileReference class which i didnt use to instanciate the file object because i wasnt uploading or downloading anything.

       

      Any form of tip will be much appreciated.

       

      Thanks.