Rename Platform.GameDir to Platform.EngineDir.

This commit is contained in:
Paul Chote
2020-11-21 15:23:36 +00:00
committed by teinarss
parent 72f1f06ebc
commit 1cc1f93fb0
18 changed files with 29 additions and 29 deletions

View File

@@ -285,7 +285,7 @@ namespace OpenRA
// Load the engine version as early as possible so it can be written to exception logs
try
{
EngineVersion = File.ReadAllText(Path.Combine(Platform.GameDir, "VERSION")).Trim();
EngineVersion = File.ReadAllText(Path.Combine(Platform.EngineDir, "VERSION")).Trim();
}
catch { }
@@ -324,7 +324,7 @@ namespace OpenRA
Settings.Game.Platform = p;
try
{
var rendererPath = Path.Combine(Platform.GameDir, "OpenRA.Platforms." + p + ".dll");
var rendererPath = Path.Combine(Platform.EngineDir, "OpenRA.Platforms." + p + ".dll");
var assembly = Assembly.LoadFile(rendererPath);
var platformType = assembly.GetTypes().SingleOrDefault(t => typeof(IPlatform).IsAssignableFrom(t));
@@ -354,7 +354,7 @@ namespace OpenRA
var modSearchArg = args.GetValue("Engine.ModSearchPaths", null);
var modSearchPaths = modSearchArg != null ?
FieldLoader.GetValue<string[]>("Engine.ModsPath", modSearchArg) :
new[] { Path.Combine(Platform.GameDir, "mods") };
new[] { Path.Combine(Platform.EngineDir, "mods") };
Mods = new InstalledMods(modSearchPaths, explicitModPaths);
Console.WriteLine("Internal mods:");

View File

@@ -136,7 +136,7 @@ namespace OpenRA
}
// Use a local directory in the game root if it exists (shared with the system support dir)
var localSupportDir = Path.Combine(GameDir, "Support");
var localSupportDir = Path.Combine(EngineDir, "Support");
if (Directory.Exists(localSupportDir))
userSupportPath = systemSupportPath = localSupportDir + Path.DirectorySeparatorChar;
@@ -169,7 +169,7 @@ namespace OpenRA
userSupportPath = path;
}
public static string GameDir
public static string EngineDir
{
get
{
@@ -194,10 +194,10 @@ namespace OpenRA
// Paths starting with . are relative to the game dir
if (path == ".")
return GameDir;
return EngineDir;
if (path.StartsWith("./", StringComparison.Ordinal) || path.StartsWith(".\\", StringComparison.Ordinal))
path = GameDir + path.Substring(2);
path = EngineDir + path.Substring(2);
return path;
}

View File

@@ -161,8 +161,8 @@ namespace OpenRA.Scripting
.ToArray();
PlayerCommands = FilterCommands(world.Map.Rules.Actors["player"], knownPlayerCommands);
runtime.Globals["GameDir"] = Platform.GameDir;
runtime.DoBuffer(File.Open(Path.Combine(Platform.GameDir, "lua", "scriptwrapper.lua"), FileMode.Open, FileAccess.Read).ReadAllText(), "scriptwrapper.lua").Dispose();
runtime.Globals["EngineDir"] = Platform.EngineDir;
runtime.DoBuffer(File.Open(Path.Combine(Platform.EngineDir, "lua", "scriptwrapper.lua"), FileMode.Open, FileAccess.Read).ReadAllText(), "scriptwrapper.lua").Dispose();
tick = (LuaFunction)runtime.Globals["Tick"];
// Register globals