Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-28176

Android: createTempDirectory() does not create a directory

    Details

    • Story Points:
      3
    • Sprint:
      2020 Sprint 21

      Description

      Summary:
      The Ti.Filesystem.createTempDirectory() method does not create the referenced directory by default on Android. It correctly returns a Ti.Filesystem.File object referencing a new directory, but the Titanium developer is forced to create it manually afterwards, which doesn't match iOS' behavior or what's implied by the method name.

      Steps to reproduce:

      1. Build and run the below on Android.
      2. Notice in the log that "exists" returns false. (This is the bug.)

      var tempDir = Ti.Filesystem.createTempDirectory();
      console.log("@@@ nativePath: " + tempDir.nativePath);
      console.log("@@@ exists: " + tempDir.exists());
      

      Note:
      Android should also be changed to create the temp directory under the Ti.Filesystem.tempDirectory like iOS. Currently, Android puts the temp directory in a radically different location that Titanium does not offer a directory constant for.

      Work-Around:
      You must create the directory manually like the below.

      var tempDir = Ti.Filesystem.createTempDirectory();
      if (OS_ANDROID) {
      	tempDir.createDirectory();
      }
      console.log("@@@ exists: " + tempDir.exists());
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jquick Joshua Quick
                Reporter:
                jquick Joshua Quick
                Reviewer:
                Gary Mathews
                Tester:
                Satyam Sekhri
              • Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                    Git Integration