Find mod folders recursively

This commit is contained in:
Björn Dahlgren 2020-12-26 13:56:59 +01:00
parent 190379fa4c
commit 5d6522d520
2 changed files with 6 additions and 5 deletions

View File

@ -1,5 +1,6 @@
var events = require('events')
var fs = require('fs.extra')
var glob = require('glob')
var path = require('path')
var Mods = function (config) {
@ -22,15 +23,14 @@ Mods.prototype.delete = function (mod, cb) {
Mods.prototype.updateMods = function () {
var self = this
fs.readdir(self.config.path, function (err, files) {
glob('**/@*/addons', { cwd: self.config.path }, function (err, files) {
if (err) {
console.log(err)
} else {
var mods = files.filter(function (file) {
return file.charAt(0) === '@'
}).map(function (name) {
var mods = files.map(function (file) {
return {
name: name
// Find actual parent mod folder from addons folder
name: path.join(file, '..')
}
})

View File

@ -31,6 +31,7 @@
"filesize": "^3.1.0",
"fs.extra": "~1.3.2",
"gamedig": "^0.2.30",
"glob": "^7.1.6",
"jquery": "^3.5.0",
"jquery.iframe-transport": "^1.0.0",
"ladda": "1.0.5",