Project: titanium
Issue TIMOB-8580: BlackBerry: Implement important Titanium.Filesystem functionality
* Titanium.Filesystem * Titanium.Filesystem.applicationDataDirectory * Titanium.Filesystem.File * Titanium.Filesystem.File.append * Titanium.Filesystem.File.createDirectory * Titanium.Filesystem.File.deleteFile * Titanium.Filesystem.File.exists * Titanium.Filesystem.File.getNativePath * Titanium.Filesystem.File.nativePath * Titanium.Filesystem.File.read * Titanium.Filesystem.File.writable * Titanium.Filesystem.File.write * Titanium.Filesystem.getFile * Titanium.Filesystem.resourcesDirectory * Titanium.Filesystem.tempDirectory h3. Test code: Reading a file from the Resources dir {code} Ti.API.info('------------------------'); Ti.API.info('Testing resources directory reading app.js'); var app_js = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, 'app.js'); var blob = app_js.read(); Ti.API.info('---------'); Ti.API.info(blob.text); {code} Creating, writing, and reading a file from the data dir {code} Ti.API.info('------------------------'); Ti.API.info('Testing data directory reading writing and reading'); var file = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, 'hello_world.txt'); if(!file.exists()) {	Ti.API.info('file does not exist');	file.write('this is a test');	Ti.API.info('file exists? ' + file.exists()); } Ti.API.info('---------'); var blob = file.read(); Ti.API.info(blob.text); {code} Getting the directory listing from the data dir {code} Ti.API.info('------------------------'); Ti.API.info('Testing data directory get listing'); var directory = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory); var files = directory.getDirectoryListing(); for(var i = 0; i < files.length; i++) {	Ti.API.info('=====================');	var file = files[i];	Ti.API.info('filename: ' + file);	var _file = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, file);	Ti.API.info('isDirectory: ' + _file.isDirectory());	Ti.API.info('isFile: ' + _file.isFile()); } {code}
Story points: 17