Index: lib/storage/io.js |
=================================================================== |
--- a/lib/storage/io.js |
+++ b/lib/storage/io.js |
@@ -39,72 +39,61 @@ 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) |
{ |
var Utils = require("utils").Utils; |
Utils.runAsync(function() |
{ |
- 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. |
- if (ext.storage.currentVersion) |
- seenDataCorruption = true; |
- delete ext.storage.currentVersion; |
- callback(null); |
- return; |
- } |
- |
var path = this._getFilePath(file); |
if (!(path in ext.storage)) |
{ |
callback(new Error("File doesn't exist")) |
return; |
} |
var lines = ext.storage[path].split(/[\r\n]+/); |
for (var i = 0; i < lines.length; i++) |
listener.process(lines[i]); |
listener.process(null); |
callback(null); |
}.bind(this)); |
}, |
- writeToFile: function(file, encode, data, callback, timeLineID) |
+ writeToFile: function(file, data, callback, timeLineID) |
{ |
var path = this._getFilePath(file); |
this._setFileContents(path, data.join(this.lineBreak) + this.lineBreak, Date.now()); |
var Utils = require("utils").Utils; |
Utils.runAsync(callback, null, null); |
}, |
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) |
{ |
var path = this._getFilePath(fromFile); |
if (!(path in ext.storage)) |
{ |