Move launchPath argument from ExternalMods ctor to .Register.
This commit is contained in:
@@ -38,15 +38,9 @@ namespace OpenRA
|
|||||||
{
|
{
|
||||||
readonly Dictionary<string, ExternalMod> mods = new Dictionary<string, ExternalMod>();
|
readonly Dictionary<string, ExternalMod> mods = new Dictionary<string, ExternalMod>();
|
||||||
readonly SheetBuilder sheetBuilder;
|
readonly SheetBuilder sheetBuilder;
|
||||||
readonly string launchPath;
|
|
||||||
|
|
||||||
public ExternalMods(string launchPath)
|
public ExternalMods()
|
||||||
{
|
{
|
||||||
// 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);
|
|
||||||
|
|
||||||
this.launchPath = launchPath;
|
|
||||||
sheetBuilder = new SheetBuilder(SheetType.BGRA, 256);
|
sheetBuilder = new SheetBuilder(SheetType.BGRA, 256);
|
||||||
|
|
||||||
// Load registered mods
|
// Load registered mods
|
||||||
@@ -83,7 +77,7 @@ namespace OpenRA
|
|||||||
mods[ExternalMod.MakeKey(mod)] = mod;
|
mods[ExternalMod.MakeKey(mod)] = mod;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void Register(Manifest mod)
|
internal void Register(Manifest mod, string launchPath)
|
||||||
{
|
{
|
||||||
if (mod.Metadata.Hidden)
|
if (mod.Metadata.Hidden)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -338,8 +338,21 @@ namespace OpenRA
|
|||||||
foreach (var mod in Mods)
|
foreach (var mod in Mods)
|
||||||
Console.WriteLine("\t{0}: {1} ({2})", mod.Key, mod.Value.Metadata.Title, mod.Value.Metadata.Version);
|
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();
|
||||||
ExternalMods = new ExternalMods(launchPath);
|
|
||||||
|
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:");
|
Console.WriteLine("External mods:");
|
||||||
foreach (var mod in ExternalMods)
|
foreach (var mod in ExternalMods)
|
||||||
Console.WriteLine("\t{0}: {1} ({2})", mod.Key, mod.Value.Title, mod.Value.Version);
|
Console.WriteLine("\t{0}: {1} ({2})", mod.Key, mod.Value.Title, mod.Value.Version);
|
||||||
@@ -385,7 +398,6 @@ namespace OpenRA
|
|||||||
Sound.StopVideo();
|
Sound.StopVideo();
|
||||||
|
|
||||||
ModData = new ModData(Mods[mod], Mods, true);
|
ModData = new ModData(Mods[mod], Mods, true);
|
||||||
ExternalMods.Register(ModData.Manifest);
|
|
||||||
|
|
||||||
if (!ModData.LoadScreen.BeforeLoad())
|
if (!ModData.LoadScreen.BeforeLoad())
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user