{ "id": "76618", "key": "TIMOB-4469", "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": [ { "id": "12077", "description": "", "name": "Sprint 2011-37", "archived": true, "released": true, "releaseDate": "2011-09-19" }, { "id": "11331", "description": "", "name": "Release 1.8.0", "archived": true, "released": true, "releaseDate": "2011-10-31" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-01-04T13:51:59.000+0000", "created": "2011-06-21T12:42:12.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "module_filesystem", "qe-testadded" ], "versions": [ { "id": "11244", "name": "Release 1.7.0", "archived": true, "released": true, "releaseDate": "2011-06-13" } ], "issuelinks": [ { "id": "15262", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "86659", "key": "TIMOB-7707", "fields": { "summary": "IOS :file system-file exists under the resource directory, but exists method returns a false", "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" } }, "priority": { "name": "Medium", "id": "3" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2013-11-13T12:35:59.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": "Note: please see [this comment|#comment-164088] below for clearer testcase and accurate explanation of the bug.\r\n\r\n1. create an empty mobile project.\r\n2. Copy the following sample code. http://pastie.org/2102937\r\n3. The image is not loaded even if it is present in the filesystem.\r\n\r\nWorks fine with Ti SDK 1.6.2", "attachment": [], "flagged": false, "summary": "Android: Filesystem exists() method used on file in resourcesDirectory always returns true even if the file is not present", "creator": { "name": "anagesh", "key": "anagesh", "displayName": "Anirudh Nagesh", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "anagesh", "key": "anagesh", "displayName": "Anirudh Nagesh", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "* Android 2.2\r\n* Ti SDK 1.7.0", "comment": { "comments": [ { "id": "157539", "author": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Please move the example code from pastie to the actual ticket. Also, does it fail if you don't put the @ in the name.", "updateAuthor": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-06-22T10:21:09.000+0000", "updated": "2011-06-22T10:21:09.000+0000" }, { "id": "157544", "author": { "name": "anagesh", "key": "anagesh", "displayName": "Anirudh Nagesh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "the code snippet can be found below.\r\n\r\n{code}\r\n// this sets the background color of the master UIView (when there are no windows/tab groups on it)\r\nTitanium.UI.setBackgroundColor('#000');\r\n\r\n// create tab group\r\n\r\nfunction find(path) \r\n{\r\n\r\n if (Titanium.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory,'KS_nav_ui@A.png').exists()) \r\n {\r\n path = 'KS_nav_ui@A.png';\r\n \r\n }\r\n\r\n return path;\r\n}\r\n//\r\n// create base UI tab and root window\r\n//\r\nvar win1 = Titanium.UI.createWindow({ \r\n title:'Tab 1',\r\n backgroundColor:'#fff',\r\n backgroundImage:find('KS_nav_ui.png')\r\n});\r\n\r\nalert(win1.backgroundImage);\r\nwin1.open();\r\n{code}\r\n\r\n2. No, it does not fail if '@' is not in the name.", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2011-06-22T10:31:28.000+0000", "updated": "2011-08-25T17:47:32.000+0000" }, { "id": "157550", "author": { "name": "anagesh", "key": "anagesh", "displayName": "Anirudh Nagesh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "sending back to dev with required info.", "updateAuthor": { "name": "anagesh", "key": "anagesh", "displayName": "Anirudh Nagesh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-06-22T11:13:40.000+0000", "updated": "2011-06-22T11:13:40.000+0000" }, { "id": "157842", "author": { "name": "thomashuelbert", "key": "thomashuelbert", "displayName": "Thomas Huelbert", "active": true, "timeZone": "America/Los_Angeles" }, "body": "kicking back so Don can see it", "updateAuthor": { "name": "thomashuelbert", "key": "thomashuelbert", "displayName": "Thomas Huelbert", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-06-27T10:17:43.000+0000", "updated": "2011-06-27T10:17:43.000+0000" }, { "id": "157843", "author": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Will look into why it's returning true. It should not.", "updateAuthor": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-06-27T10:22:00.000+0000", "updated": "2011-06-27T10:22:00.000+0000" }, { "id": "160128", "author": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Attaching code where I added more logging statements. I could not get this to fail. It is not always returning true.\n\n{code}\n\n// this sets the background color of the master UIView (when there are no windows/tab groups on it)\nTitanium.UI.setBackgroundColor('#000');\n\nfunction find(path) {\n\n\tTi.API.debug(\"Path with @ exists: \" + Titanium.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory,'KS_nav_ui@A.png').exists());\n\tTi.API.debug(\"Path w/o @ exists: \" + Titanium.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory,'KS_nav_ui.png').exists());\n\n\tif (Titanium.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory,'KS_nav_ui@A.png').exists()) {\n\t\tpath = 'KS_nav_ui@A.png';\t\n\t}\n\n\treturn path;\n}\n//\n// create base UI tab and root window\n//\nvar win1 = Titanium.UI.createWindow({ \n title:'Tab 1',\n backgroundColor:'#fff',\n backgroundImage:find('KS_nav_ui.png')\n});\n\nalert(win1.backgroundImage);\nwin1.open();\n{code}", "updateAuthor": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-07-20T15:57:33.000+0000", "updated": "2011-07-20T15:57:33.000+0000" }, { "id": "160142", "author": { "name": "anagesh", "key": "anagesh", "displayName": "Anirudh Nagesh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Don,\r\n\r\nI can still reproduce the issue with 1.7.0! I double checked it with both 1.6.2 and 1.7.0\r\nIn 1.6.2, 'exists()' returns false and true properly when the file is not present in the resources directory.\r\nIn 1.7.0, it always returns true.\r\n\r\nPlease let me know if you need any further information.", "updateAuthor": { "name": "anagesh", "key": "anagesh", "displayName": "Anirudh Nagesh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-07-20T17:07:22.000+0000", "updated": "2011-07-20T17:07:22.000+0000" }, { "id": "164088", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "body": "This has been reported again in TC-211. Note that this issue specifically occurs for testing the existence of files in resourcesDirectory. Other locations, such as applicationDataDirectory, are not affected.\r\n\r\nEnvironment Information:\r\n* Titanium SDK version: 1.7.2.97c3689.\r\n* Platform & version: Android 2.1.1 and Android 2.3.3\r\n* Device Details: Android 2.1.1 and Android 2.3.3\r\n* Host Operating System: OSX 10.7 (Lion)\r\n* Titanium Studio version: Titanium Studio, build: 1.0.2.201107130739\r\n\r\nThe user has observed this problem using the following Titanium SDKs:\r\n\r\n* 1.7.1 - No bug\r\n* 1.7.2 - Bug exists\r\n* 1.7.3 - Bug exists\r\n\r\nI have also verified that the issue still exists in 1.7.3.\r\n\r\nThe user has provided a simpler testcase as follows:\r\n\r\n{code:lang=javascript|title=app.js}\r\nvar resourcesFileDoesExist = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, 'app.js');\r\nvar resourcesFileDoesNotExist = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, 'this-file-does-not-exist.js');\r\n\r\nvar newFile = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory,'this-file-exists.js');\r\nnewFile.write(\"testing a file\");\r\n\r\nvar appDataFileDoesExist = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, 'this-file-exists.js');\r\nvar appDataFileDoesNotExist = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, 'this-file-does-not-exist.js');\r\n\r\nvar label = Ti.UI.createLabel({\r\n color: '#FFF'\r\n});\r\nlabel.text = '*** Resources Dir: \\nTest presence of file that exists => ' +\r\n resourcesFileDoesExist.exists() +\r\n '\\nTest presence of file that does not exist => ' +\r\n resourcesFileDoesNotExist.exists() +\r\n '\\n\\n*** appData Dir: \\nTest presence of file that exists => ' +\r\n appDataFileDoesExist.exists() +\r\n '\\nTest presence of file that does not exist => ' +\r\n appDataFileDoesNotExist.exists();\r\n\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: '#000'\r\n});\r\nwin.add(label);\r\nwin.open();\r\n{code}\r\n\r\nExpected Results:\r\n{code}\r\n*** Resources Dir:\r\nTrue\r\nFalse\r\n*** appData Dir:\r\nTrue\r\nFalse\r\n{code}\r\n\r\nActual Results:\r\n{code}\r\n*** Resources Dir:\r\nTrue\r\nTrue\r\n*** appData Dir:\r\nTrue\r\nFalse\r\n{code}", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2011-08-25T16:52:21.000+0000", "updated": "2011-08-26T01:49:36.000+0000" }, { "id": "164879", "author": { "name": "jalter", "key": "jalter", "displayName": "Jon Alter", "active": true, "timeZone": "America/Los_Angeles" }, "body": "h2. folder.exists()\r\n\r\nh4. Description \r\nexists() returns \"false\" when pointing to a folder that exists and \"true\" when the folder does not exist\r\n\r\nh4. Steps to reproduce\r\nStep 1: create a new app\r\nStep 2: run the code below\r\nStep 3: click the window\r\nStep 4: look in the console \r\nStep 5: notice that there is no \"data\" directory but exists returns \"true\"\r\nStep 6: create a \"data\" directory in Resources, and create a couple files inside it\r\nStep 7: make a small change to tiapp.xml, delete the change, and save the file so that fastdev will pull in your new folder\r\nStep 8: run the app\r\nStep 9: click the window\r\nStep 10: notice that there is now a \"data\" directory but exists returns \"false\"\r\nStep 11: notice that getDirectoryListing listed the contents of your data directory, proving that the folder is indeed there\r\n\r\nh4. Repro Case\r\n{code:title=app.js}\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor:\"#fff\"\r\n});\r\nwin.open();\r\n\r\nwin.addEventListener('click', function(e){\r\n\tvar srcDataDir = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, \"data\");\r\n \tTi.API.info('SRC EXISTS = ' + srcDataDir.exists());\r\n\tTi.API.info('SRC LISTING = ' + srcDataDir.getDirectoryListing());\r\n});\r\n{code}\r\n\r\nh4. Environment\r\nTiSDK 1.7.2\r\nAndroid Emulator 2.2\r\n\r\nh4. Associated Helpdesk Ticket\r\nhttp://appc.me/c/APP-728922", "updateAuthor": { "name": "jalter", "key": "jalter", "displayName": "Jon Alter", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-09-01T18:13:21.000+0000", "updated": "2011-09-01T18:13:21.000+0000" }, { "id": "166202", "author": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "body": "We need to make sure to test the fix for this with Fastdev automatic changes, it looks like the current changeset disables it completely. The test is pretty simple:\r\n\r\n* Run the project from TiStudio on the emulator (Fastdev should be automatically started)\r\n* After the app starts, change some JS code directly in TiStudio\r\n* Re-run the app (it should restart almost immediately, and have the changes you just made -- coming from FastDev mode)", "updateAuthor": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-09-15T12:27:31.000+0000", "updated": "2011-09-15T12:27:31.000+0000" }, { "id": "175555", "author": { "name": "mpettiford", "key": "mpettiford", "displayName": "Michael Pettiford", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Tested on Ti Studio 1.0.7.201112080131\r\n
Ti Mob SDK 1.8.0.1.v20111209011840\r\n
OSX Lion\r\nNexus S OS 2.3.6, Android emulator with fast dev mode on\r\n\r\nExpected filesystem behavior is shown", "updateAuthor": { "name": "mpettiford", "key": "mpettiford", "displayName": "Michael Pettiford", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-12-09T11:06:05.000+0000", "updated": "2011-12-09T11:06:05.000+0000" }, { "id": "178016", "author": { "name": "mpettiford", "key": "mpettiford", "displayName": "Michael Pettiford", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Reopening/closing to add/remove labels", "updateAuthor": { "name": "mpettiford", "key": "mpettiford", "displayName": "Michael Pettiford", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-01-04T13:49:51.000+0000", "updated": "2012-01-04T13:49:51.000+0000" } ], "maxResults": 13, "total": 13, "startAt": 0 } } }