Skip to content

Commit

Permalink
Merge pull request #12828 from Phrohdoh/util-engine-mod-search-paths
Browse files Browse the repository at this point in the history
Utility and server: Get mod search paths from env MOD_SEARCH_PATHS
  • Loading branch information
obrakmann committed Apr 14, 2017
2 parents 9637e1b + 4d5f9e0 commit 63e4fbc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 6 additions & 1 deletion OpenRA.Server/Program.cs
Expand Up @@ -11,6 +11,7 @@

using System;
using System.IO;
using System.Linq;
using System.Net;
using System.Threading;
using OpenRA.Support;
Expand Down Expand Up @@ -42,8 +43,12 @@ static void Main(string[] args)
Game.InitializeSettings(arguments);
var settings = Game.Settings.Server;

var envModSearchPaths = Environment.GetEnvironmentVariable("MOD_SEARCH_PATHS");
var modSearchPaths = !string.IsNullOrWhiteSpace(envModSearchPaths) ?
FieldLoader.GetValue<string[]>("MOD_SEARCH_PATHS", envModSearchPaths) :
new[] { Path.Combine(".", "mods"), Path.Combine("^", "mods") };

var mod = Game.Settings.Game.Mod;
var modSearchPaths = new[] { Path.Combine(".", "mods"), Path.Combine("^", "mods") };
var mods = new InstalledMods(modSearchPaths, explicitModPaths);

// HACK: The engine code *still* assumes that Game.ModData is set
Expand Down
6 changes: 5 additions & 1 deletion OpenRA.Utility/Program.cs
Expand Up @@ -45,7 +45,11 @@ static void Main(string[] args)

Game.InitializeSettings(Arguments.Empty);

var modSearchPaths = new[] { Path.Combine(".", "mods"), Path.Combine("^", "mods") };
var envModSearchPaths = Environment.GetEnvironmentVariable("MOD_SEARCH_PATHS");
var modSearchPaths = !string.IsNullOrWhiteSpace(envModSearchPaths) ?
FieldLoader.GetValue<string[]>("MOD_SEARCH_PATHS", envModSearchPaths) :
new[] { Path.Combine(".", "mods"), Path.Combine("^", "mods") };

if (args.Length == 0)
{
PrintUsage(new InstalledMods(modSearchPaths, new string[0]), null);
Expand Down

0 comments on commit 63e4fbc

Please sign in to comment.