From 6deb49e095a2b4ace21bc673899cb58f05e1f071 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Wed, 14 Sep 2016 19:44:57 +0100 Subject: [PATCH 1/3] Resolve a bare "." to the game install path. --- OpenRA.Game/Platform.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OpenRA.Game/Platform.cs b/OpenRA.Game/Platform.cs index d7e03389af..b94da9e017 100644 --- a/OpenRA.Game/Platform.cs +++ b/OpenRA.Game/Platform.cs @@ -106,6 +106,9 @@ namespace OpenRA path = SupportDir + path.Substring(1); // paths starting with . are relative to the game dir + if (path == ".") + return GameDir; + if (path.StartsWith("./") || path.StartsWith(".\\")) path = GameDir + path.Substring(2); From 1eac43fa6df0535466eb38f5e1ebd2bee01ece6f Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Wed, 14 Sep 2016 19:46:49 +0100 Subject: [PATCH 2/3] Fix string comparison cultures in Platform. --- OpenRA.Game/Platform.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenRA.Game/Platform.cs b/OpenRA.Game/Platform.cs index b94da9e017..b083016570 100644 --- a/OpenRA.Game/Platform.cs +++ b/OpenRA.Game/Platform.cs @@ -102,14 +102,14 @@ namespace OpenRA path = path.TrimEnd(new char[] { ' ', '\t' }); // paths starting with ^ are relative to the support dir - if (path.StartsWith("^")) + if (path.StartsWith("^", StringComparison.Ordinal)) path = SupportDir + path.Substring(1); // paths starting with . are relative to the game dir if (path == ".") return GameDir; - if (path.StartsWith("./") || path.StartsWith(".\\")) + if (path.StartsWith("./", StringComparison.Ordinal) || path.StartsWith(".\\", StringComparison.Ordinal)) path = GameDir + path.Substring(2); return path; @@ -124,10 +124,10 @@ namespace OpenRA /// Replace the full path prefix with the special notation characters ^ or . public static string UnresolvePath(string path) { - if (path.StartsWith(SupportDir)) + if (path.StartsWith(SupportDir, StringComparison.Ordinal)) path = "^" + path.Substring(SupportDir.Length); - if (path.StartsWith(GameDir)) + if (path.StartsWith(GameDir, StringComparison.Ordinal)) path = "./" + path.Substring(GameDir.Length); return path; From 632b277a0e22f79dbdf2329202b8014613644d9a Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Wed, 14 Sep 2016 19:46:58 +0100 Subject: [PATCH 3/3] Other misc fixes in Platform. --- OpenRA.Game/Platform.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/OpenRA.Game/Platform.cs b/OpenRA.Game/Platform.cs index b083016570..fb1c175095 100644 --- a/OpenRA.Game/Platform.cs +++ b/OpenRA.Game/Platform.cs @@ -39,8 +39,8 @@ namespace OpenRA var kernelName = p.StandardOutput.ReadToEnd(); if (kernelName.Contains("Darwin")) return PlatformType.OSX; - else - return PlatformType.Linux; + + return PlatformType.Linux; } catch { } @@ -82,7 +82,6 @@ namespace OpenRA case PlatformType.OSX: dir += "/Library/Application Support/OpenRA"; break; - case PlatformType.Linux: default: dir += "/.openra"; break; @@ -101,11 +100,11 @@ namespace OpenRA { path = path.TrimEnd(new char[] { ' ', '\t' }); - // paths starting with ^ are relative to the support dir + // Paths starting with ^ are relative to the support dir if (path.StartsWith("^", StringComparison.Ordinal)) path = SupportDir + path.Substring(1); - // paths starting with . are relative to the game dir + // Paths starting with . are relative to the game dir if (path == ".") return GameDir;