Fix file path issue.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { By, Key, until } = require('selenium-webdriver');
|
||||
|
||||
const { createIdentity } = require('./identityHandler');
|
||||
@@ -100,13 +101,13 @@ async function createAccount(driver) {
|
||||
|
||||
|
||||
let accounts = [];
|
||||
if (fs.existsSync('../accounts/accounts.json')) {
|
||||
if (fs.existsSync(path.join(__dirname, '../accounts/accounts.json'))) {
|
||||
const content = fs.readFileSync('accounts.json', 'utf8');
|
||||
accounts = JSON.parse(content);
|
||||
}
|
||||
|
||||
accounts.push(account);
|
||||
fs.writeFileSync('../accounts/accounts.json', JSON.stringify(accounts));
|
||||
fs.writeFileSync(path.join(__dirname, '../accounts/accounts.json'), JSON.stringify(accounts));
|
||||
|
||||
console.log('Account saved to accounts.json, there are currently ' + accounts.length + ' accounts');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user