absolute path
This commit is contained in:
parent
288e47c845
commit
40f5bdcdc8
6
index.js
6
index.js
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user