From d43ffa58140c3f974d4e91b1b7d6e9f57fa53078 Mon Sep 17 00:00:00 2001 From: alse Date: Tue, 9 Jun 2020 21:11:47 +0530 Subject: [PATCH] Fixing paths in restore.js --- restore.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/restore.js b/restore.js index 7864028..b5f392e 100644 --- a/restore.js +++ b/restore.js @@ -1,11 +1,13 @@ //load database var Datastore = require('nedb'); +var crontab = require("./crontab"); +var path = require("path"); var exec = require('child_process').exec; var fs = require('fs'); exports.crontabs = function(db_name, callback){ - var db = new Datastore({ filename: __dirname + '/crontabs/' + db_name }); + var db = new Datastore({filename: path.join(crontab.db_folder, db_name)}); db.loadDatabase(function (err) { }); db.find({}).sort({ created: -1 }).exec(function(err, docs){ @@ -14,7 +16,7 @@ exports.crontabs = function(db_name, callback){ }; exports.delete = function(db_name){ - fs.unlink(__dirname + '/crontabs/' + db_name, function(err){ + fs.unlink(path.join(crontab.db_folder, db_name), function(err){ if(err) { return console.log("Delete error: " + err); }