mirror of
https://github.com/Dahlgren/arma-server-web-admin.git
synced 2024-08-30 17:22:10 +00:00
Find mod folders recursively
This commit is contained in:
parent
190379fa4c
commit
5d6522d520
10
lib/mods.js
10
lib/mods.js
@ -1,5 +1,6 @@
|
|||||||
var events = require('events')
|
var events = require('events')
|
||||||
var fs = require('fs.extra')
|
var fs = require('fs.extra')
|
||||||
|
var glob = require('glob')
|
||||||
var path = require('path')
|
var path = require('path')
|
||||||
|
|
||||||
var Mods = function (config) {
|
var Mods = function (config) {
|
||||||
@ -22,15 +23,14 @@ Mods.prototype.delete = function (mod, cb) {
|
|||||||
|
|
||||||
Mods.prototype.updateMods = function () {
|
Mods.prototype.updateMods = function () {
|
||||||
var self = this
|
var self = this
|
||||||
fs.readdir(self.config.path, function (err, files) {
|
glob('**/@*/addons', { cwd: self.config.path }, function (err, files) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.log(err)
|
console.log(err)
|
||||||
} else {
|
} else {
|
||||||
var mods = files.filter(function (file) {
|
var mods = files.map(function (file) {
|
||||||
return file.charAt(0) === '@'
|
|
||||||
}).map(function (name) {
|
|
||||||
return {
|
return {
|
||||||
name: name
|
// Find actual parent mod folder from addons folder
|
||||||
|
name: path.join(file, '..')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
"filesize": "^3.1.0",
|
"filesize": "^3.1.0",
|
||||||
"fs.extra": "~1.3.2",
|
"fs.extra": "~1.3.2",
|
||||||
"gamedig": "^0.2.30",
|
"gamedig": "^0.2.30",
|
||||||
|
"glob": "^7.1.6",
|
||||||
"jquery": "^3.5.0",
|
"jquery": "^3.5.0",
|
||||||
"jquery.iframe-transport": "^1.0.0",
|
"jquery.iframe-transport": "^1.0.0",
|
||||||
"ladda": "1.0.5",
|
"ladda": "1.0.5",
|
||||||
|
Loading…
Reference in New Issue
Block a user