From 01c24d7eec9a4480ef79d9a400e25a706fcf6c92 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sun, 5 Aug 2018 02:45:10 +0000 Subject: [PATCH] update savefile location --- lib/extensions/index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/extensions/index.js b/lib/extensions/index.js index a6bd1a9..2a57926 100644 --- a/lib/extensions/index.js +++ b/lib/extensions/index.js @@ -19,12 +19,13 @@ var readFileAsync = util.promisify(fs.readFile); var mkdirpAsync = util.promisify(require('mkdirp')); var TRUSTED_ISSUERS = [ 'oauth3.org' ]; var DB = {}; +DB._savefile = path.join(__dirname, 'permissions.json'); DB._load = function () { try { - DB._perms = require('./permissions.json'); + DB._perms = require(DB._savefile); } catch(e) { try { - DB._perms = require('./permissions.json.bak'); + DB._perms = require(DB._savefile + '.bak'); } catch(e) { DB._perms = []; } @@ -188,7 +189,7 @@ DB.ports._add = function (acc, number) { }); }; DB._save = function () { - return sfs.writeFileAsync('./accounts.json', JSON.stringify(DB._perms)); + return sfs.writeFileAsync(DB._savefile, JSON.stringify(DB._perms)); }; DB._saveToken = null; DB._savePromises = [];