From 7dedbc9f4509b8517e73fe85672c4f2074e462c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjo=CC=88rn=20Dahlgren?= Date: Wed, 4 Oct 2017 00:50:07 +0200 Subject: [PATCH] Support logs directory for Arma, Arma 2 and Arma 2 OA --- lib/logs.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/lib/logs.js b/lib/logs.js index b0da050..681de6c 100644 --- a/lib/logs.js +++ b/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) {