Skip navigation
Currently Being Moderated

Creation and Modification dates for android file system

Oct 1, 2012 3:05 AM

Tags: #file #air #android #mobile #date #creation #modification #filereference

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.

 
Replies
  • Currently Being Moderated
    Dec 20, 2012 2:18 AM   in reply to l33tian

    I run into the same problem while working on some sort of file synching task.

    Trying to read the file.modificationDate or creationDate results in an error: "Error #3003: File or directory does not exist."

     

    I have obeserved that this only happens for files that were packaged with the app (and placed in the File.applicationDirectory).

    Files that my app has downloaded and saved to the device (File.applicationStorageDirectory) do have a valid creation date and modification date.

    Maybe the File.applicationDirectory has different rights?

     

    Does anybody have a solution or workaround for this?

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 20, 2012 7:41 PM   in reply to reinier_77

    reinier_77:

     

    maybe it is the authority setting on Andriod due to secrity issue?

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 18, 2013 5:48 AM   in reply to Wingnow

    I just ran into this too. It's still happenning on Adobe Air SDK 3.7. Perhaps this is the wrong forum for this question.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points