{ "id": "106530", "key": "TIMOB-13444", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "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": null, "resolutiondate": null, "created": "2012-12-14T08:08:13.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "js", "production" ], "versions": [], "issuelinks": [], "assignee": null, "updated": "2018-06-21T02:13:20.000+0000", "status": { "description": "This issue was once resolved, but the resolution was deemed incorrect. From here issues are either marked assigned or resolved.", "name": "Reopened", "id": "4", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [ { "id": "12305", "name": "Core", "description": "Central component of the Platform (outside of Tooling, or platform specific implementation details)" } ], "description": "using the code above you can test a difference in behavior in dev and production.\r\ngiven the assets in attachment (unzip in your ressources dir), in development you will get a list of js files in the console.\r\nIn production you will get an empty list.\r\n\r\nThis is normal as the js are compiled and not really there. My question is could we get a behavior as with Titanium.Filesystem.File.exists which works on compiled js files (as shown is KitchenSink).\r\n\r\nThanks\r\n{code}\r\nvar dir = Titanium.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory, 'toto');\r\nvar dir_files = dir.getDirectoryListing();\r\nif (!dir_files || dir_files === null || dir_files.length === 0){\r\n\tTi.API.info('no files to list in ' + dir.nativePath );\r\n}\r\nelse{\r\n\tfor (var i = 0; i < dir_files.length; i++) {\r\n\t\tTi.API.info('found file ' + dir_files[i] );\r\n\t}\r\n}\r\n\r\n{code}", "attachment": [ { "id": "34177", "filename": "toto.zip", "author": { "name": "farfromrefuge", "key": "farfromrefuge", "displayName": "Martin Guillon", "active": false, "timeZone": "Europe/Berlin" }, "created": "2012-12-14T08:08:13.000+0000", "size": 661, "mimeType": "application/zip" } ], "flagged": false, "summary": "TiAPI: getDirectoryListing used with compiled js files", "creator": { "name": "farfromrefuge", "key": "farfromrefuge", "displayName": "Martin Guillon", "active": false, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "farfromrefuge", "key": "farfromrefuge", "displayName": "Martin Guillon", "active": false, "timeZone": "Europe/Berlin" }, "environment": "titanium 3.1.0 master\r\nios sdk 6.0\r\ndevice/simulator", "comment": { "comments": [ { "id": "246163", "author": { "name": "dsefton", "key": "dsefton", "displayName": "Daniel Sefton", "active": true, "timeZone": "America/Los_Angeles" }, "body": "So you want to be able to get a list of the JavaScript files of an application in production? Please could you explain why?\r\n\r\nAlso note that the JavaScript files when compiled no longer exist at all... They're all encoded into a string...", "updateAuthor": { "name": "dsefton", "key": "dsefton", "displayName": "Daniel Sefton", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-04-06T18:15:27.000+0000", "updated": "2013-07-02T18:56:54.000+0000" }, { "id": "246233", "author": { "name": "farfromrefuge", "key": "farfromrefuge", "displayName": "Martin Guillon", "active": false, "timeZone": "Europe/Berlin" }, "body": "Yes Daniel i know all about that and if you read carefully that s exactly what i wrote.\nBut as i mentioned Titanium.Filesystem.File.exists works with compiled JS.\n(easily as it just goes through the array of compiled js and look for the file).\nSo it is doable (i will code it by the way ;))\n\nAlso IT DOES MAKE SENSE. Why wouldn't go through your js files. I can think of 10 use cases right of my mind :\n- an app with multiple games, each one represented by a js file. Using getDirectoryListing you can know how many games you have (without having to manage a var for that)\n- using css (or call it jss, rjss ...)., getDirectoryListing allows you not have to maintain a definite list of files (which can be different on every platform).\nThe later is actually one i use all the time. And it s the one blocking me right now in production.", "updateAuthor": { "name": "farfromrefuge", "key": "farfromrefuge", "displayName": "Martin Guillon", "active": false, "timeZone": "Europe/Berlin" }, "created": "2013-04-07T08:31:01.000+0000", "updated": "2013-04-07T08:31:01.000+0000" }, { "id": "260737", "author": { "name": "farfromrefuge", "key": "farfromrefuge", "displayName": "Martin Guillon", "active": false, "timeZone": "Europe/Berlin" }, "body": "I actually have this working in my branch. I use it a lot.\r\nThe main reason for using getDirectoryListing with compile scripts is to be able to require/include compiled js files (js files in production).\r\n", "updateAuthor": { "name": "farfromrefuge", "key": "farfromrefuge", "displayName": "Martin Guillon", "active": false, "timeZone": "Europe/Berlin" }, "created": "2013-07-03T11:45:37.000+0000", "updated": "2013-07-03T11:45:37.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }