diff --git a/config.js.example b/config.js.example index 71c2363..a1ec59e 100644 --- a/config.js.example +++ b/config.js.example @@ -1,3 +1,4 @@ module.exports = { - path: 'path-to-arma3-directory' + path: 'path-to-arma3-directory', + type: 'linux', // Can be either linux, windows or wine }; diff --git a/manager.js b/manager.js index 2985155..fd64cd8 100644 --- a/manager.js +++ b/manager.js @@ -12,7 +12,11 @@ function Server(id, title, port, mods) { } Server.prototype.armaServerPath = function() { - return config.path + '/arma3server'; + if (config.type === "linux") { + return config.path + '/arma3server'; + } + + return config.path + '/arma3server.exe'; } Server.prototype.makeModsParameter = function() { @@ -24,10 +28,27 @@ Server.prototype.makePortParameter = function() { } Server.prototype.start = function() { - var mods = this.makeModsParameter(); - var port = this.makePortParameter(); + var startParams = []; + var gamePath = this.armaServerPath(); - var process = spawn(this.armaServerPath(), [mods, port, '-config=server.cfg', '-noSound', '-world=empty']); + if (config.type === "wine") { + gamePath = "wine"; + startParams.push(this.armaServerPath()); + } + + startParams.push(this.makePortParameter()); + startParams.push('-config=server.cfg'); + startParams.push('-noSound'); + startParams.push('-world=empty'); + + if (this.mods.length) { + startParams.push(this.makeModsParameter()); + } + + console.log(gamePath); + console.log(startParams); + + var process = spawn(gamePath, startParams); var self = this; process.stdout.on('data', function (data) {