diff --git a/CHANGELOG.md b/CHANGELOG.md index 321c505d..4f05db2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,7 +24,7 @@ Thanks to: @dathbe. - [clock] Add CSS to prevent line breaking of sunset/sunrise time display (#3816) - [core] Enhance system information logging format and include additional env and RAM details (#3839, #3843) - [refactor] Add new file `js/module_functions.js` to move code used in several modules to one place (#3837) -- [refactor] Use global.root_path where possible (#3883) +- [refactor] Use global.root_path where possible (#3883, #3885) - [tests] refactor: simplify jest config file (#3844) - [tests] refactor: extract constants for weather electron tests (#3845) - [tests] refactor: add `setupDOMEnvironment` helper function to eliminate repetitive JSDOM setup code (#3860) diff --git a/js/check_config.js b/js/check_config.js index bd35b3e2..628c3747 100644 --- a/js/check_config.js +++ b/js/check_config.js @@ -5,8 +5,9 @@ const Ajv = require("ajv"); const globals = require("globals"); const { Linter } = require("eslint"); -const Log = require(`${global.root_path}/js/logger.js`); -const Utils = require(`${global.root_path}/js/utils.js`); +const rootPath = path.resolve(`${__dirname}/../`); +const Log = require(`${rootPath}/js/logger.js`); +const Utils = require(`${rootPath}/js/utils.js`); const linter = new Linter({ configType: "flat" }); const ajv = new Ajv(); @@ -18,7 +19,7 @@ const ajv = new Ajv(); */ function getConfigFile () { // FIXME: This function should be in core. Do you want refactor me ;) ?, be good! - return path.resolve(process.env.MM_CONFIG_FILE || `${global.root_path}/config/config.js`); + return path.resolve(process.env.MM_CONFIG_FILE || `${rootPath}/config/config.js`); } /** diff --git a/js/utils.js b/js/utils.js index 2e312218..d20d6cf6 100644 --- a/js/utils.js +++ b/js/utils.js @@ -1,4 +1,7 @@ -const Log = require(`${global.root_path}/js/logger.js`); +const path = require("node:path"); + +const rootPath = path.resolve(`${__dirname}/../`); +const Log = require(`${rootPath}/js/logger.js`); const os = require("node:os"); const fs = require("node:fs"); const si = require("systeminformation");