{ "id": "126283", "key": "TIMOB-16445", "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": "2", "description": "The problem described is an issue which will never be fixed.", "name": "Won't Fix" }, "resolutiondate": "2017-05-22T21:21:46.000+0000", "created": "2014-02-11T19:57:55.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "linvalid" ], "versions": [ { "id": "15856", "description": "Release 3.2.1", "name": "Release 3.2.1", "archived": false, "released": true, "releaseDate": "2014-02-10" } ], "issuelinks": [], "assignee": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-05-22T22:09:58.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": [], "description": "h5. Problem description\r\n\r\nUsing Anvil for SyncServer testing, an issue is surfacing when using Ti.Filesystem.getFile for checking folder. \r\n\r\nAttached sample code run manually on device works as expected.\r\n\r\nSee lines 153 to 170 of the attached sample code 'app.js':\r\n{code}\r\n function copyfiles(){\r\n var srcDataDir = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, \"myfiles\");\r\n var destDataDir = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, \"myfiles\");\r\n destDataDir.createDirectory();\r\n var files = srcDataDir.getDirectoryListing();\r\n var qty = files.length;\r\n Ti.API.info('#### qty: ' + JSON.stringify(qty));\r\n for(var i = 0; i < (qty-1); i++) {\r\n var srcFile = Ti.Filesystem.getFile(srcDataDir.nativePath, files[i]);\r\n var destFile = Ti.Filesystem.getFile(destDataDir.nativePath, files[i]);\r\n destFile.write(srcFile.read());\r\n\r\n if (!destFile.exists()) {\r\n \t alert(destFile.nativePath);\r\n };\r\n }\r\n }\r\n{code}\r\n\r\nWhen run on device, it works as expected (destFile.exists() returns true).\r\n\r\nHowever, running the same code on Anvil and adding a valueOf check:\r\n{code}\r\nvalueOf(testRun,destFile.exists()).shouldBeTrue();\r\n{code}\r\n\r\nis returning false, thus an error.\r\n\r\n\r\n'externalfilesync.js' file attached is the Anvil test sample - see 'function copyfiles()' line 214.", "attachment": [], "flagged": false, "summary": "Anvil: issues using Ti.Filesystem.getFile", "creator": { "name": "fcasali", "key": "fcasali", "displayName": "Federico Casali", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "fcasali", "key": "fcasali", "displayName": "Federico Casali", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Anvil\r\nTiSDK 3.2.1", "comment": { "comments": [ { "id": "420171", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Anvil is no longer supported, this ticket is now irrelevant.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-05-22T21:21:46.000+0000", "updated": "2017-05-22T21:21:46.000+0000" } ], "maxResults": 1, "total": 1, "startAt": 0 } } }