Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Medium
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: Release 9.3.0
-
Component/s: Android
-
Labels:
-
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:
- Build and run the below on Android.
- 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
- relates to
-
TIMOB-28058 Android: Change Ti.Filesystem "temp" APIs to use app's cache folder
-
- Closed
-