mirror of
https://github.com/Dahlgren/arma-server-web-admin.git
synced 2024-08-30 17:22:10 +00:00
8a16c69e3e
* Mod info * Size * Steam Workshop info
24 lines
604 B
JavaScript
24 lines
604 B
JavaScript
var armaClassParser = require('arma-class-parser')
|
|
var fs = require('fs')
|
|
var path = require('path')
|
|
|
|
module.exports = function (modPath, config, callback) {
|
|
var metaCpp = path.resolve(config.path, modPath, 'meta.cpp')
|
|
fs.readFile(metaCpp, 'utf8', function (err, data) {
|
|
if (err) {
|
|
return callback(null, null)
|
|
}
|
|
|
|
try {
|
|
var meta = armaClassParser.parse(data)
|
|
callback(null, {
|
|
id: meta.publishedid,
|
|
name: meta.name
|
|
})
|
|
} catch (err) {
|
|
console.log('Error parsing meta.cpp for ' + modPath + ', ' + err)
|
|
callback(null, null)
|
|
}
|
|
})
|
|
}
|