2 Replies Latest reply on Jun 4, 2009 10:02 AM by Joe ... Ward

    File.createDirectory() - Error #3003

    Typidee

      Hello,  I'm attempting to create a subdirectory in File.applicationStorageDirectory as per the following:

       

      public class MyClass

      {

      private static var _f:File = File.applicationStorageDirectory.resolvePath("mySubDir");


      public static function init() : void

      {

      _f.createDirectory();  //fails with IOError #3003

      }

      }

       

      MyClass.init();

       

      When that code is executed the directory is created if it does not already exist, but a #3003 error is thrown (File or directory does not exist)

       

      If the path resolution is done within a static method however, it works as expected.

       

      public class MyClass

      {

      private static var _f:File;


      public static function init() : void

      {

      var file:File = File.applicationStorageDirectory.resolvePath("mySubDir");

      file.createDirectory();  //works as expected 

      _f = file;

      }

      }


      MyClass.init();

       

      Am I missing something obvious here and/or is this expected behavior?

       

      Thanks!

       

      -Matt