Fix file path issue.

This commit is contained in:
2023-05-19 18:27:56 +02:00
parent 16426f96a9
commit b85b84f4b9
4 changed files with 19 additions and 7 deletions

View File

@@ -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');