Fix issue where a fresh install's web UI returns an error because the mods directory does not exist.

This commit is contained in:
Daniel Ceregatti 2023-10-15 12:01:26 -07:00
parent a3f062799c
commit a5560962bc

View file

@ -145,6 +145,7 @@ const getDirSize = (dirPath) => {
const getCustomXML = (modId) => {
const ret = []
if (! fs.existsSync(config.modDir)) return ret
for(const file of configFiles) {
if (fs.existsSync(config.modDir + d + modId + d + file)) {
ret.push({name:file})
@ -166,6 +167,7 @@ const getModNameById = (id) => {
const getMods = () => {
const mods = []
if (! fs.existsSync(config.modDir)) return mods
fs.readdirSync(config.modDir).forEach(file => {
const name = getModNameById(file)
mods.push({name:name,id:file})