[TIMOB-12742] Android/iOS: Ti.Filesystem.Filestream.isWriteable() doesn't work properly
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Reopened |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | TiAPI |
Labels | android, iOS |
Reporter | Carter Lathrop |
Assignee | Unknown |
Created | 2013-02-12T18:26:48.000+0000 |
Updated | 2018-02-28T20:03:20.000+0000 |
Description
*Problem*
Bug description: Ti.Filesystem.Filestream.isWriteable() gives error in Android & iOS.
*Steps to reproduce:*
1. copy and paste test code below into app.js
2. add attached file.txt to Resources folder
3. run code on device in android
4. click isReadable button, notice it works and returns boolean value true
5. click isWriteable button, notice error when it should return boolean value false
6. repeat steps on iOS simulator to see similar result
*Expected Behavior*
isWriteable should return false
*Actual Behavior*
isWritable throws error
*Code example:*
var win = Ti.UI.createWindow({
backgroundColor : 'black'
});
var button1 = Ti.UI.createButton({
top : 10,
title : 'isReadable?'
});
var button2 = Ti.UI.createButton({
top : 100,
title : 'isWritable?'
});
button1.addEventListener('click', function(e) {
var infile = Titanium.Filesystem.getFile('file.txt');
if (!infile.exists()) {
Ti.API.error("File not exists()");
return;
}
var instream = infile.open(Titanium.Filesystem.MODE_READ);
var isReadable = instream.isReadable();
alert('Is readable = ' + isReadable);
});
button2.addEventListener('click', function(e) {
var infile = Titanium.Filesystem.getFile('file.txt');
if (!infile.exists()) {
Ti.API.error("File not exists()");
return;
}
var instream = infile.open(Titanium.Filesystem.MODE_READ);
var isWriteable = instream.isWriteable();
alert('Is writeable = ' + isWriteable);
});
win.add(button1);
win.add(button2);
win.open();
Attachments
File | Date | Size |
---|---|---|
file.txt | 2013-02-14T22:15:22.000+0000 | 11 |
FileStreamSample.zip | 2013-02-14T11:52:02.000+0000 | 755338 |
Hello Roman, Would you mind providing a reproducible piece of test code that once could just paste into a project and run to produce the bug? This way I can reproduce exactly what you are trying and determine if it should be moved to engineering from there. Thank you, Carter
Hello Carter, I attached the test project. Just run it. Regards, Roman
Roman, I was able to recreate your bug so I will be moving this to Ti-Mobile and engineering will take a look at it. I have created my own test case though so that the error is more visible. Please keep a watch on the ticket and thank you for bringing this to our attention. Best, Carter