[AC-3083] File.exists on Android always returns true
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Duplicate |
Resolution Date | 2011-08-25T16:59:46.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | android, filesystem, mobile |
Reporter | Matthew O'Riordan |
Assignee | Tony Guntharp |
Created | 2011-08-16T05:24:06.000+0000 |
Updated | 2016-03-08T07:48:08.000+0000 |
Description
The exists() function of the Titanium.Filesystem.File always returns true on Android, even when the file does not actually exist.
var fileDoesNotExist = Titanium.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory, 'this-file-does-not-exist.js');
var fileDoesExist = Titanium.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory, 'app.js');
var label = Titanium.UI.createLabel({
color: '#FFF'
});
label.text = 'Test presence of file that exists => ' + fileDoesExist.exists() +
'\nTest presence of file that does not exist => ' + fileDoesNotExist.exists();
var win = Titanium.UI.createWindow({
backgroundColor: '#000'
});
win.add(label);
win.open();
I have tested this with both Android 2.1.1 and Android 2.3.3, using the latest stable Titanium Mobile SDK 1.7.2
BTW. I have done some basic tests and this seems to be an issue with 1.7.2, 1.7.3 but not with 1.7.1
Thanks for the excellent code. I've moved this information to the existing ticket, TIMOB-4469. Cheers
Closing due to inactivity.