Index: lib/filesystem/io.js |
=================================================================== |
--- a/lib/filesystem/io.js |
+++ b/lib/filesystem/io.js |
@@ -43,48 +43,33 @@ var IO = exports.IO = |
lineBreak: "\n", |
resolveFilePath: function(path) |
{ |
return new FakeFile(path); |
}, |
- readFromFile: function(file, decode, listener, callback, timeLineID) |
+ readFromFile: function(file, listener, callback, timeLineID) |
{ |
// Hack to allow importing old data |
if (typeof file == "string") |
{ |
var Utils = require("utils").Utils; |
Utils.runAsync(function() |
{ |
var lines = file.split(/[\r\n]+/); |
for (var i = 0; i < lines.length; i++) |
listener.process(lines[i]); |
listener.process(null); |
callback(null); |
}.bind(this)); |
return; |
} |
- if ("spec" in file && /^defaults\b/.test(file.spec)) |
- { |
- // Code attempts to read the default patterns.ini, we don't have that. |
- // Make sure to execute first-run actions instead. |
- var Utils = require("utils").Utils; |
- Utils.runAsync(function() |
- { |
- if (ext.storage.currentVersion) |
- seenDataCorruption = true; |
- delete ext.storage.currentVersion; |
- callback(null); |
- }); |
- return; |
- } |
- |
this._getFileEntry(file, false, function(fs, fileEntry) |
{ |
fileEntry.file(function(file) |
{ |
var reader = new FileReader(); |
reader.onloadend = function() |
{ |
if (reader.error) |
@@ -98,17 +83,17 @@ var IO = exports.IO = |
callback(null); |
} |
}; |
reader.readAsText(file); |
}, callback); |
}, callback); |
}, |
- writeToFile: function(file, encode, data, callback, timeLineID) |
+ writeToFile: function(file, data, callback, timeLineID) |
{ |
this._getFileEntry(file, true, function(fs, fileEntry) |
{ |
fileEntry.createWriter(function(writer) |
{ |
var executeWriteOperation = function(op, nextOperation) |
{ |
writer.onwriteend = function() |
@@ -144,28 +129,28 @@ var IO = exports.IO = |
}.bind(this), callback); |
}.bind(this), callback); |
}, |
copyFile: function(fromFile, toFile, callback) |
{ |
// Simply combine read and write operations |
var data = []; |
- this.readFromFile(fromFile, false, { |
+ this.readFromFile(fromFile, { |
process: function(line) |
{ |
if (line !== null) |
data.push(line); |
} |
}, function(e) |
{ |
if (e) |
callback(e); |
else |
- this.writeToFile(toFile, false, data, callback); |
+ this.writeToFile(toFile, data, callback); |
}.bind(this)); |
}, |
renameFile: function(fromFile, newName, callback) |
{ |
this._getFileEntry(fromFile, false, function(fs, fileEntry) |
{ |
fileEntry.moveTo(fs.root, newName, function() |