mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-09-15 08:27:37 +00:00
refactor: use global.root_path instead relative paths (#3883)
This commit is contained in:
@@ -13,10 +13,9 @@ app.use(basicAuth);
|
||||
|
||||
// Set available directories
|
||||
const directories = ["/tests/configs", "/tests/mocks"];
|
||||
const rootPath = path.resolve(`${__dirname}/../../../`);
|
||||
|
||||
for (let directory of directories) {
|
||||
app.use(directory, express.static(path.resolve(rootPath + directory)));
|
||||
app.use(directory, express.static(path.resolve(`${global.root_path}/${directory}`)));
|
||||
}
|
||||
|
||||
let server;
|
||||
|
@@ -1,9 +1,13 @@
|
||||
const path = require("node:path");
|
||||
const os = require("node:os");
|
||||
const fs = require("node:fs");
|
||||
const jsdom = require("jsdom");
|
||||
|
||||
const indexFile = `${__dirname}/../../../index.html`;
|
||||
const cssFile = `${__dirname}/../../../css/custom.css`;
|
||||
// global absolute root path
|
||||
global.root_path = path.resolve(`${__dirname}/../../../`);
|
||||
|
||||
const indexFile = `${global.root_path}/index.html`;
|
||||
const cssFile = `${global.root_path}/css/custom.css`;
|
||||
const sampleCss = [
|
||||
".region.row3 {",
|
||||
" top: 0;",
|
||||
@@ -29,7 +33,7 @@ exports.startApplication = async (configFilename, exec) => {
|
||||
process.env.mmTestMode = "true";
|
||||
process.setMaxListeners(0);
|
||||
if (exec) exec;
|
||||
global.app = require("../../../js/app");
|
||||
global.app = require(`${global.root_path}/js/app`);
|
||||
|
||||
return global.app.start();
|
||||
};
|
||||
|
Reference in New Issue
Block a user