diff --git a/framework/assets/js/file.js b/framework/assets/js/file.js index caf5652c..4699ea8f 100644 --- a/framework/assets/js/file.js +++ b/framework/assets/js/file.js @@ -195,17 +195,10 @@ FileReader.prototype.readAsText = function(file) navigator.fileMgr.addFileReader(this.fileName,this); //alert("Calling File.read : " + this.fileName); //window.location = "gap://File.readFile/"+ file; - this.onerror = errorCallback; - this.oncomplete = successCallback; return FileUtil.read(fileName); } -FileReader.prototype.hasRead(data) -{ - -} - // File Writer function FileWriter() @@ -232,6 +225,10 @@ FileWriter.prototype.writeAsText = function(file,text,bAppend) navigator.fileMgr.addFileWriter(file,this); this.readyState = 0; // EMPTY var call = FileUtil.write(file, text, bAppend); + if(call > 0) + this.onerror(); + else + this.oncomplete(); this.result = null; } diff --git a/framework/src/com/phonegap/FileUtils.java b/framework/src/com/phonegap/FileUtils.java index 84d528fe..b1161ffc 100644 --- a/framework/src/com/phonegap/FileUtils.java +++ b/framework/src/com/phonegap/FileUtils.java @@ -97,7 +97,7 @@ public class FileUtils { data = "FAIL: IO ERROR"; } - mView.loadUrl("javascript:navigator.FileReader.hasRead('" + data + "')"); + //mView.loadUrl("javascript:navigator.FileReader.hasRead('" + data + "')"); return data; } @@ -113,9 +113,11 @@ public class FileUtils { out.write(buff, 0, rawData.length); out.flush(); out.close(); - mView.loadUrl("javascript:navigator.file.onsuccess('File written')"); + //mView.loadUrl("javascript:navigator.FileReader.onsuccess('File written')"); } catch (Exception e) { - mView.loadUrl("javascript:navigator.file.onerror('Fail')"); + //mView.loadUrl("javascript:navigator.FileReader.onerror('Fail')"); + // So, do we just return -1 at this point! + return -1; } return 0; }