refactor: use dataPath variable as given in file config (#1118)
* Actually use path variables as given in default config * Drop paths.content, avoid populating the global WIKI object
This commit is contained in:
committed by
Nicolas Giard
parent
5b36988d6d
commit
8000ebec8f
@@ -10,7 +10,7 @@ module.exports = {
|
||||
return
|
||||
}
|
||||
|
||||
const sideloadExists = await fs.pathExists(path.join(WIKI.ROOTPATH, 'data/sideload'))
|
||||
const sideloadExists = await fs.pathExists(path.resolve(WIKI.ROOTPATH, WIKI.config.dataPath, 'sideload'))
|
||||
|
||||
if (!sideloadExists) {
|
||||
return
|
||||
@@ -25,16 +25,16 @@ module.exports = {
|
||||
}
|
||||
},
|
||||
async importLocales() {
|
||||
const localeExists = await fs.pathExists(path.join(WIKI.ROOTPATH, 'data/sideload/locales.json'))
|
||||
const localeExists = await fs.pathExists(path.resolve(WIKI.ROOTPATH, WIKI.config.dataPath, 'sideload/locales.json'))
|
||||
if (localeExists) {
|
||||
WIKI.logger.info('Found locales master file. Importing locale packages...')
|
||||
let importedLocales = 0
|
||||
|
||||
const locales = await fs.readJson(path.join(WIKI.ROOTPATH, 'data/sideload/locales.json'))
|
||||
const locales = await fs.readJson(path.resolve(WIKI.ROOTPATH, WIKI.config.dataPath, 'sideload/locales.json'))
|
||||
if (locales && _.has(locales, 'data.localization.locales')) {
|
||||
for (const locale of locales.data.localization.locales) {
|
||||
try {
|
||||
const localeData = await fs.readJson(path.join(WIKI.ROOTPATH, `data/sideload/${locale.code}.json`))
|
||||
const localeData = await fs.readJson(path.resolve(WIKI.ROOTPATH, WIKI.config.dataPath, `sideload/${locale.code}.json`))
|
||||
if (localeData) {
|
||||
WIKI.logger.info(`Importing ${locale.name} locale package...`)
|
||||
|
||||
|
@@ -16,7 +16,7 @@ module.exports = {
|
||||
},
|
||||
init() {
|
||||
// Clear content cache
|
||||
fs.emptyDir(path.join(WIKI.ROOTPATH, 'data/cache'))
|
||||
fs.emptyDir(path.resolve(WIKI.ROOTPATH, WIKI.config.dataPath, 'cache'))
|
||||
|
||||
return this
|
||||
},
|
||||
|
Reference in New Issue
Block a user