Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'modsPath' optional setting #243

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ var webpack = require('webpack')
var webpackMiddleware = require('webpack-dev-middleware')

var config = require('./config')

if( !config.modsPath
|| typeof config.modsPath !== 'string'
|| config.modsPath.length < 1)
{
config.modsPath = config.path
}

var webpackConfig = require('./webpack.config')
var setupBasicAuth = require('./lib/setup-basic-auth')
var Manager = require('./lib/manager')
Expand Down
1 change: 1 addition & 0 deletions config.js.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module.exports = {
game: 'arma3', // arma3, arma2oa, arma2, arma1, cwa, ofpresistance, ofp
path: 'path-to-arma3-directory',
//modsPath: 'optional-path-to-mods-directory-that-defaults-to-PATH-to-arma3-directory-if-empty-or-undefined',
port: 3000,
host: '0.0.0.0', // Can be either an IP or a Hostname
type: 'linux', // Can be either linux, windows or wine
Expand Down
2 changes: 1 addition & 1 deletion lib/mods/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Mods.prototype.delete = function (mod, cb) {

Mods.prototype.updateMods = function () {
var self = this
glob('**/{@*,csla,gm,spe,vn,ws}/addons', { cwd: self.config.path }, function (err, files) {
glob('**/{@*,csla,gm,spe,vn,ws}/addons', { cwd: self.config.modsPath }, function (err, files) {
if (err) {
console.log(err)
return
Expand Down
2 changes: 1 addition & 1 deletion lib/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var Settings = function (config) {
}

Settings.prototype.getPublicSettings = function () {
return _.pick(this.config, ['game', 'path', 'type'])
return _.pick(this.config, ['game', 'path', 'modsPath', 'type'])
}

module.exports = Settings
1 change: 1 addition & 0 deletions public/js/app/models/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ var Backbone = require('backbone')
module.exports = Backbone.Model.extend({
defaults: {
path: '',
modsPath: '',
type: ''
},
urlRoot: '/api/settings'
Expand Down
6 changes: 6 additions & 0 deletions public/js/tpl/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
<input type="text" class="form-control" placeholder="Path to ArmA" disabled value="<%- path %>">
</div>
</div>
<div class="form-group">
<label for="mods" class="col-sm-2 control-label">Mods folder</label>
<div class="col-sm-10">
<input type="text" class="form-control" placeholder="Mods folder" disabled value="<%- modsPath %>">
</div>
</div>

<div class="form-group">
<label for="type" class="col-sm-2 control-label">Type</label>
Expand Down