Server: Get mod search paths from env MOD_SEARCH_PATHS
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using OpenRA.Support;
|
using OpenRA.Support;
|
||||||
@@ -42,8 +43,12 @@ namespace OpenRA.Server
|
|||||||
Game.InitializeSettings(arguments);
|
Game.InitializeSettings(arguments);
|
||||||
var settings = Game.Settings.Server;
|
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 mod = Game.Settings.Game.Mod;
|
||||||
var modSearchPaths = new[] { Path.Combine(".", "mods"), Path.Combine("^", "mods") };
|
|
||||||
var mods = new InstalledMods(modSearchPaths, explicitModPaths);
|
var mods = new InstalledMods(modSearchPaths, explicitModPaths);
|
||||||
|
|
||||||
// HACK: The engine code *still* assumes that Game.ModData is set
|
// HACK: The engine code *still* assumes that Game.ModData is set
|
||||||
|
|||||||
@@ -46,10 +46,9 @@ namespace OpenRA
|
|||||||
Game.InitializeSettings(Arguments.Empty);
|
Game.InitializeSettings(Arguments.Empty);
|
||||||
|
|
||||||
var envModSearchPaths = Environment.GetEnvironmentVariable("MOD_SEARCH_PATHS");
|
var envModSearchPaths = Environment.GetEnvironmentVariable("MOD_SEARCH_PATHS");
|
||||||
var modSearchPaths = (!string.IsNullOrWhiteSpace(envModSearchPaths) ? envModSearchPaths.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
|
var modSearchPaths = !string.IsNullOrWhiteSpace(envModSearchPaths) ?
|
||||||
: new[] { Path.Combine(".", "mods"), Path.Combine("^", "mods") })
|
FieldLoader.GetValue<string[]>("MOD_SEARCH_PATHS", envModSearchPaths) :
|
||||||
.Select(path => path.Trim())
|
new[] { Path.Combine(".", "mods"), Path.Combine("^", "mods") };
|
||||||
.ToArray();
|
|
||||||
|
|
||||||
if (args.Length == 0)
|
if (args.Length == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user