Removed static directory address in datastore.js

This commit is contained in:
Christer Warén 2021-06-16 04:49:45 +03:00
parent f9ba5a3117
commit 9b67506558

View File

@ -9,10 +9,10 @@ module.exports = class {
loadData() { loadData() {
//console.log(""); //console.log("");
const dataFiles = fs.readdirSync("D:/GitHub/eximiabots-radiox/datastore"/*path.join(path.dirname(__dirname), 'datastore')*/).filter(f => f.endsWith('.json')); const dataFiles = fs.readdirSync(path.join(path.dirname(__dirname), '../datastore')).filter(f => f.endsWith('.json'));
for (const file of dataFiles) { for (const file of dataFiles) {
try { try {
const json = require(`../../datastore/${file}`); const json = require(`../../../datastore/${file}`);
this.map.set(json.guild.id, json); this.map.set(json.guild.id, json);
//console.log('[LOADED] ' + file + " (" + json.guild.id + ")"); //console.log('[LOADED] ' + file + " (" + json.guild.id + ")");
//console.log(JSON.stringify(json, null, 4)); //console.log(JSON.stringify(json, null, 4));
@ -115,7 +115,7 @@ module.exports = class {
saveEntry(file, data) { saveEntry(file, data) {
data = JSON.stringify(data, null, 4); data = JSON.stringify(data, null, 4);
fs.writeFile(path.join(path.dirname(__dirname), 'datastore') + "/" + file + ".json", data, 'utf8', function(err) { fs.writeFile(path.join(path.dirname(__dirname), '../datastore') + "/" + file + ".json", data, 'utf8', function(err) {
if (err) { if (err) {
//console.log(err); //console.log(err);
} }