|
|
|
@ -288,9 +288,7 @@ Persistence.prototype.loadDatabase = function (cb) { |
|
|
|
|
async.waterfall([ |
|
|
|
|
function (cb) { |
|
|
|
|
Persistence.ensureDirectoryExists(path.dirname(self.filename), function (err) { |
|
|
|
|
fs.exists(self.filename, function (exists) { |
|
|
|
|
if (!exists) { return fs.writeFile(self.filename, '', 'utf8', function (err) { cb(err); }); } |
|
|
|
|
|
|
|
|
|
self.ensureDatafileIntegrity(function (exists) { |
|
|
|
|
fs.readFile(self.filename, 'utf8', function (err, rawData) { |
|
|
|
|
if (err) { return cb(err); } |
|
|
|
|
var treatedData = Persistence.treatRawData(rawData); |
|
|
|
|