Use `settings.root` to anchor pathnames

pull/4822/head
Richard Hansen 2021-02-10 01:21:29 -05:00 committed by John McLear
parent f868788417
commit a45e85a730
3 changed files with 7 additions and 7 deletions

View File

@ -1,7 +1,6 @@
'use strict';
const path = require('path');
const npm = require('npm');
const fs = require('fs');
const util = require('util');
const settings = require('../../utils/Settings');
@ -29,7 +28,7 @@ exports.expressCreateServer = (hookName, args, cb) => {
res.end(`var specs_list = ${JSON.stringify(files)};\n`);
});
const rootTestFolder = path.join(npm.root, '../tests/frontend/');
const rootTestFolder = path.join(settings.root, 'src/tests/frontend/');
const url2FilePath = (url) => {
let subPath = url.substr('/tests/frontend'.length);

View File

@ -4,8 +4,7 @@ const languages = require('languages4translatewiki');
const fs = require('fs');
const path = require('path');
const _ = require('underscore');
const npm = require('npm');
const plugins = require('../../static/js/pluginfw/plugin_defs.js').plugins;
const pluginDefs = require('../../static/js/pluginfw/plugin_defs.js');
const existsSync = require('../utils/path_exists');
const settings = require('../utils/Settings');
@ -38,10 +37,12 @@ const getAllLocales = () => {
};
// add core supported languages first
extractLangs(`${npm.root}/ep_etherpad-lite/locales`);
extractLangs(path.join(settings.root, 'src/locales'));
// add plugins languages (if any)
for (const pluginName in plugins) extractLangs(path.join(npm.root, pluginName, 'locales'));
for (const {package: {path: pluginPath}} of Object.values(pluginDefs.plugins)) {
extractLangs(path.join(pluginPath, 'locales'));
}
// Build a locale index (merge all locale data other than user-supplied overrides)
const locales = {};

View File

@ -32,7 +32,7 @@ const log4js = require('log4js');
const logger = log4js.getLogger('Minify');
const ROOT_DIR = path.normalize(`${__dirname}/../../static/`);
const ROOT_DIR = path.join(settings.root, 'src/static/');
const threadsPool = new Threads.Pool(() => Threads.spawn(new Threads.Worker('./MinifyWorker')), 2);