{ "id": "64156", "key": "TIMOB-3524", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2017-05-02T21:47:41.000+0000", "created": "2011-04-15T03:46:16.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "android", "defect" ], "versions": [], "issuelinks": [], "assignee": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-05-02T21:47:41.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "{html}
Environment:
\nAlthough the createFile()
method is documented in\n\nTitanium.Filesystem.File, no code exists for it in the Titanium\nAndroid SDK source, at \nTiBaseFile.java. Furthermore, no demonstration of its usage\nexists in \nfilesystem.js.
The workaround is to use the write()
method\ninstead, but unless a string is passed to it (even and empty one\nlike write(\"\")
) then the file is not created.
The following code demonstrates the issue:
\nvar newDir = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory,'html');\nTi.API.info(\"newDir.nativePath = \" + newDir.nativePath);\n\nnewDir.createDirectory();\n\nvar fileTest = Ti.Filesystem.getFile(newDir.nativePath,'test.html');\nfileTest.deleteFile();\nTi.API.info(\"test.html exists before write()? \" + fileTest.exists());\nfileTest.write();\nTi.API.info(\"test.html exists after write()? \" + fileTest.exists());\nfileTest.write('');\nTi.API.info(\"test.html exists after write('')? \" + fileTest.exists());
\n
\nProposed solution:
\ncreateFile()
from API docswrite()
method to accept no argument, in\norder to create an empty fileNote that depending on the chosen solution, obviously the tags\nused in this ticket may be incorrect, and another ticket may need\nto raised.