From 4383baf1770e1ca62a89c8a8f9c7da5eed28dcab Mon Sep 17 00:00:00 2001 From: Elanis Date: Sat, 30 Apr 2022 18:51:19 +0200 Subject: [PATCH] Use config to locate source data --- main.server.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/main.server.js b/main.server.js index 6cf7fae..ae4b3f9 100644 --- a/main.server.js +++ b/main.server.js @@ -1,8 +1,7 @@ import fs from 'fs'; -const folder = 'G:\\Lumen\\resources\\app\\data\\focus-stats\\'; -const tags = JSON.parse(fs.readFileSync(folder + 'tags.json')); -const history = JSON.parse(fs.readFileSync(folder + 'history.json')); +const tags = JSON.parse(fs.readFileSync(config['focus-stats']['dataFolder'] + 'tags.json')); +const history = JSON.parse(fs.readFileSync(config['focus-stats']['dataFolder'] + 'history.json')); export default class FocusStats { static init() { @@ -23,7 +22,7 @@ export default class FocusStats { dbEntriesMapped[dbEntry.date.getTime()] = dbEntry; } - const history = JSON.parse(fs.readFileSync(folder + 'history.json')); + const history = JSON.parse(fs.readFileSync(config['focus-stats']['dataFolder'] + 'history.json')); for(const name in history) { for(const exe in history[name]) { if(name === '' && exe === '') { @@ -73,7 +72,7 @@ export default class FocusStats { // We won't do it now because there's now way to remove tags from UI atm // Insert tags - const tags = JSON.parse(fs.readFileSync(folder + 'tags.json')); + const tags = JSON.parse(fs.readFileSync(config['focus-stats']['dataFolder'] + 'tags.json')); for(const name in tags) { for(const exe in tags[name]) { for(const tag of tags[name][exe]) {