mirror of
https://github.com/Dahlgren/arma-server-web-admin.git
synced 2024-08-30 17:22:10 +00:00
Support logs directory for Arma, Arma 2 and Arma 2 OA
This commit is contained in:
parent
056150a30a
commit
7dedbc9f45
20
lib/logs.js
20
lib/logs.js
@ -4,6 +4,14 @@ var filesize = require('filesize')
|
||||
var path = require('path')
|
||||
var userhome = require('userhome')
|
||||
|
||||
var gamesLogFolder = {
|
||||
arma1: 'ArmA',
|
||||
arma2: 'ArmA 2',
|
||||
arma2oa: 'ArmA 2 OA',
|
||||
arma3: 'Arma 3',
|
||||
arma3_x64: 'Arma 3'
|
||||
}
|
||||
|
||||
var Logs = function (config) {
|
||||
this.config = config
|
||||
|
||||
@ -29,13 +37,19 @@ Logs.prototype.logsPath = function () {
|
||||
return path.join(this.config.path, 'logs')
|
||||
}
|
||||
|
||||
var gameLogFolder = gamesLogFolder[this.config.game]
|
||||
|
||||
if (!gameLogFolder) {
|
||||
return null
|
||||
}
|
||||
|
||||
if (this.config.type === 'windows') {
|
||||
return userhome('AppData', 'Local', 'Arma 3')
|
||||
return userhome('AppData', 'Local', gameLogFolder)
|
||||
}
|
||||
|
||||
if (this.config.type === 'wine') {
|
||||
var username = process.env.USER
|
||||
return userhome('.wine', 'drive_c', 'users', username, 'Local Settings', 'Application Data', 'Arma 3')
|
||||
return userhome('.wine', 'drive_c', 'users', username, 'Local Settings', 'Application Data', gameLogFolder)
|
||||
}
|
||||
|
||||
return null
|
||||
@ -45,7 +59,7 @@ Logs.prototype.logFiles = function (callback) {
|
||||
var directory = this.logsPath()
|
||||
|
||||
if (directory === null) {
|
||||
callback(null, [])
|
||||
return callback(null, [])
|
||||
}
|
||||
|
||||
fs.readdir(directory, function (err, files) {
|
||||
|
Loading…
Reference in New Issue
Block a user