Skip to content

Commit

Permalink
Merge pull request #155 from Dahlgren/feature/recursive-mods-folders
Browse files Browse the repository at this point in the history
Find mod folders recursively
  • Loading branch information
Dahlgren authored Dec 26, 2020
2 parents 190379f + 5d6522d commit 239ce6f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/mods.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand All @@ -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, '..')
}
})

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 239ce6f

Please sign in to comment.