update savefile location

This commit is contained in:
AJ ONeal 2018-08-05 02:45:10 +00:00
parent 4f2948d0f0
commit 01c24d7eec
1 changed files with 4 additions and 3 deletions

View File

@ -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 = [];