Move launchPath argument from ExternalMods ctor to .Register.

This commit is contained in:
Paul Chote
2017-06-27 18:16:00 +00:00
committed by reaperrr
parent daf8f8d956
commit b30cfe4ada
2 changed files with 17 additions and 11 deletions

View File

@@ -338,8 +338,21 @@ namespace OpenRA
foreach (var mod in Mods)
Console.WriteLine("\t{0}: {1} ({2})", mod.Key, mod.Value.Metadata.Title, mod.Value.Metadata.Version);
var launchPath = args.GetValue("Engine.LaunchPath", Assembly.GetEntryAssembly().Location);
ExternalMods = new ExternalMods(launchPath);
ExternalMods = new ExternalMods();
Manifest currentMod;
if (modID != null && Mods.TryGetValue(modID, out currentMod))
{
var launchPath = args.GetValue("Engine.LaunchPath", Assembly.GetEntryAssembly().Location);
// Sanitize input from platform-specific launchers
// Process.Start requires paths to not be quoted, even if they contain spaces
if (launchPath.First() == '"' && launchPath.Last() == '"')
launchPath = launchPath.Substring(1, launchPath.Length - 2);
ExternalMods.Register(Mods[modID], launchPath);
}
Console.WriteLine("External mods:");
foreach (var mod in ExternalMods)
Console.WriteLine("\t{0}: {1} ({2})", mod.Key, mod.Value.Title, mod.Value.Version);
@@ -385,7 +398,6 @@ namespace OpenRA
Sound.StopVideo();
ModData = new ModData(Mods[mod], Mods, true);
ExternalMods.Register(ModData.Manifest);
if (!ModData.LoadScreen.BeforeLoad())
return;