diff --git a/lib/mods.js b/lib/mods.js index 466c194..a8ad0ae 100644 --- a/lib/mods.js +++ b/lib/mods.js @@ -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, '..') } }) diff --git a/package.json b/package.json index b2f6af2..f4f294b 100644 --- a/package.json +++ b/package.json @@ -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",