absolute path

This commit is contained in:
simio 2024-11-30 18:44:06 -03:00
parent 288e47c845
commit 40f5bdcdc8

View File

@ -1,8 +1,10 @@
const fs = require('fs')
const irc = require('irc');
const settings = JSON.parse(fs.readFileSync('settings.json'));
const settings = JSON.parse(fs.readFileSync(rootDir + '/settings.json'));
const readline = require('readline')
const model = 'user,date,message'
const { dirname } = require('path');
const rootDir = dirname(require.main.filename);
let currentChannel = settings.channels[0]
@ -60,7 +62,7 @@ client.addListener('registered', () => {
////////////////////////////////////////////////////////////////
const formattedDate = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
const filename = 'logs/' + channel + '.csv'
const filename = rootDir + '/logs/' + channel + '.csv'
if (!fs.existsSync(filename)){
fs.writeFileSync(filename, model)