Description:
In the below test case, getFile() method of Filesystem is used for returning the file present at apps Resources folder.
The application crashes when tried to open the return file object by using its open() method.
This is not a regression as able to reproduce it with 3.4.0 GA and 3.3.0.GA.
TestCase:
var f = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, 'acceptance.js');
var stream = f.open(Ti.Filesystem.MODE_READ); // crash
STEPS TO REPRODUCE:
1. Create the classic iOS titanium application.
2. Replace the code in app.js with the code mentioned above.
3. Add any file named as acceptance.js in its Resources folder.
4. Build the application and launch it on device.
EXPECTED RESULTs:
4. The application should launch successfully on device.
ACTUAL RESULTS:
4. The application crashes while launching with the below error.
Please refer attachment as well.
[ERROR] : Script Error {
[ERROR] : column = 20;
[ERROR] : line = 12;
[ERROR] : sourceURL = "file:///private/var/mobile/Containers/Bundle/Application/5D52A62E-8359-43BA-8E22-CB95096B69CE/TIMOB-18078.app/app.js";
[ERROR] : stack = "global code@file:///private/var/mobile/Containers/Bundle/Application/5D52A62E-8359-43BA-8E22-CB95096B69CE/TIMOB-18078.app/app.js:12:20";
[ERROR] : }
The problem seems with passing .js file as argument to getFile() method. The below code works fine. var f = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, 'acceptance.txt'); var stream = f.open(Ti.Filesystem.MODE_READ); // crash