{ "id": "163773", "key": "TIMOB-23994", "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": "20238", "description": "", "name": "Release 7.5.0", "archived": false, "released": true, "releaseDate": "2018-11-15" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2018-08-24T01:48:38.000+0000", "created": "2016-10-06T15:30:31.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "qe-6.0.0" ], "versions": [ { "id": "16980", "description": "New V8", "name": "Release 6.0.0", "archived": false, "released": true, "releaseDate": "2016-11-15" }, { "id": "18322", "name": "Release 5.5.1", "archived": false, "released": true, "releaseDate": "2016-09-28" } ], "issuelinks": [ { "id": "52999", "type": { "id": "10001", "name": "Cloners", "inward": "is cloned into", "outward": "is cloned from" }, "inwardIssue": { "id": "163776", "key": "TIMOB-23995", "fields": { "summary": "iOS: Using __dirname in app.js errors with Can't find variable: __dirname ", "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": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2018-08-24T01:48:42.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" }, { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "h5.Description\r\n\r\n*This is not a regression occurs using 5.5.1.GA stack*\r\n\r\nWhen using {{__filename}} in an app.js file the following is thrown\r\n\r\n*Using __filename in any file other than app.js works*\r\n\r\n{code}\r\n[ERROR] : Application Error: {\r\n[ERROR] : \"line\": 2,\r\n[ERROR] : \"column\": 10,\r\n[ERROR] : \"message\": \"require: Error while require(/app) Can't find variable: __filename\",\r\n[ERROR] : \"native_stack\": [\r\n[ERROR] : \"JSExportClass::CallNamedFunction\"\r\n[ERROR] : ]\r\n[ERROR] : }\r\n{code}\r\n\r\nh5.Steps to reproduce\r\n\r\n# In your app.js add {{console.log(__filename)}}\r\n# Build for Android, iOS or Windows\r\n\r\nh5.Actual result\r\n\r\nThe above error is thrown\r\n\r\nh5.Expected result\r\n\r\n__filename should be able to be used in app.js file", "attachment": [], "flagged": false, "summary": "Android: Using __filename in app.js errors with Can't find variable: __filename", "creator": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "subtasks": [], "reporter": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "environment": "OS: Microsoft Windows 10 Pro 10.0.14393\r\nAppc core: 6.0.0-56\r\nAppc NPM: 4.2.8-7\r\nTi SDK: 6.0.0.v20161006013211\r\nAppc Studio: 4.8.0.201610060953\r\niPhone 6: 10.02\r\nNote 4: 5.0.0\r\nLumia 550 10.0", "closedSprints": [ { "id": 1058, "state": "closed", "name": "2018 Sprint 16 SDK", "startDate": "2018-07-29T22:26:06.486Z", "endDate": "2018-08-12T22:26:00.000Z", "completeDate": "2018-08-13T17:38:16.757Z", "originBoardId": 114 }, { "id": 1045, "state": "closed", "name": "2018 Sprint 13 SDK", "startDate": "2018-06-17T20:47:13.621Z", "endDate": "2018-07-01T20:47:00.000Z", "completeDate": "2018-07-02T18:40:05.029Z", "originBoardId": 114 }, { "id": 1050, "state": "closed", "name": "2018 Sprint 14 SDK", "startDate": "2018-07-01T18:40:57.193Z", "endDate": "2018-07-15T18:40:00.000Z", "completeDate": "2018-07-16T03:27:08.720Z", "originBoardId": 114 }, { "id": 1053, "state": "closed", "name": "2018 Sprint 15 SDK", "startDate": "2018-07-15T21:52:05.453Z", "endDate": "2018-07-29T21:52:00.000Z", "completeDate": "2018-07-29T22:25:11.723Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "403672", "author": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Fixed for Windows: https://github.com/appcelerator/titanium_mobile_windows/pull/903", "updateAuthor": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-12-20T12:28:19.000+0000", "updated": "2016-12-20T12:28:19.000+0000" }, { "id": "412073", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "On iOS, the {{__filename}} property is injected inside the CommonJS scope. Example:\r\napp.js\r\n{code:js}\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: '#fff'\r\n});\r\n\r\nvar btn = Ti.UI.createButton({\r\n title: 'Trigger'\r\n});\r\n\r\nbtn.addEventListener('click', function() {\r\n var test = require('/test');\r\n});\r\n\r\nwin.add(btn);\r\nwin.open();\r\n{code}\r\ntest.js:\r\n{code:js}\r\nalert(__filename);\r\n{code}\r\n\r\nThis will work. It won't work on the app.js. [~cwilliams] Is this an intended behavior?", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-03-14T14:55:24.000+0000", "updated": "2017-03-14T14:55:24.000+0000" }, { "id": "417106", "author": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Moving to post 6.1.0.\r\n", "updateAuthor": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-04-10T16:13:58.000+0000", "updated": "2017-04-10T16:13:58.000+0000" }, { "id": "440599", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "PR: https://github.com/appcelerator/titanium_mobile/pull/10247", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-08-09T08:43:36.000+0000", "updated": "2018-08-12T07:46:22.000+0000" }, { "id": "440749", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "*Closing ticket.* Verified fix in SDK version: {{7.4.0.v20180810061237}}. Application no longer crashes when using {{(__filename)}} or {{(__dirname)}}.\r\n\r\n*FR Passed (Test Steps):*\r\n# Created a new application using Titanium\r\n# Added the following in to the {{app.js}}\r\n{code:java}\r\nTi.API.info(__dirname);\r\nTi.API.info(__filename);\r\n{code}\r\n# Ran the program \r\n# Application no longer showed an error and the following could be seen in the console \r\n{code:java}\r\n[INFO] : /\r\n[INFO] : /app.js\r\n{code}\r\n*Test Environment*\r\n{code:java}\r\nAPPC Studio: 5.1.0.201808080937\r\nAPPC CLI: 7.0.4\r\nPixel XL (8.1)\r\nOperating System Name: Mac OS High Sierra\r\nOperating System Version: 10.13\r\nNode.js Version: 8.9.1\r\nXcode 9.2\r\n{code}\r\n", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-08-14T13:31:33.000+0000", "updated": "2018-08-14T13:31:33.000+0000" }, { "id": "440751", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "*Edit* SDK Version: {[7.4.0.v20180813131247}} was used.\r\n\r\n", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-08-14T13:35:45.000+0000", "updated": "2018-08-14T13:35:45.000+0000" } ], "maxResults": 9, "total": 9, "startAt": 0 } } }