diff options
author | Ignacio Etcheverry <ignalfonsore@gmail.com> | 2020-03-14 19:01:29 +0100 |
---|---|---|
committer | Ignacio Etcheverry <ignalfonsore@gmail.com> | 2020-03-14 19:01:29 +0100 |
commit | 1b634785b50a8be5ff6f06feeb13726750115615 (patch) | |
tree | e7ac2491c2391bca2d592f3ef9796d26180512fc /modules/mono/editor/GodotTools/GodotTools.ProjectEditor/DotNetSolution.cs | |
parent | ce01b83c4af6b61febecea68596a0806d8723d10 (diff) |
C#: Replace uses of old Configuration and update old csprojs
Diffstat (limited to 'modules/mono/editor/GodotTools/GodotTools.ProjectEditor/DotNetSolution.cs')
-rw-r--r-- | modules/mono/editor/GodotTools/GodotTools.ProjectEditor/DotNetSolution.cs | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/DotNetSolution.cs b/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/DotNetSolution.cs index be57683c1f..9afd9adeb1 100644 --- a/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/DotNetSolution.cs +++ b/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/DotNetSolution.cs @@ -121,15 +121,30 @@ EndProject"; @" {{{0}}}.{1}|Any CPU.ActiveCfg = {1}|Any CPU {{{0}}}.{1}|Any CPU.Build.0 = {1}|Any CPU"; - public static void FixConfigurations(string slnPath) + public static void MigrateFromOldConfigNames(string slnPath) { if (!File.Exists(slnPath)) return; - + var input = File.ReadAllText(slnPath); + + if (!Regex.IsMatch(input, Regex.Escape("Tools|Any CPU"))) + return; + + // This method renames old configurations in solutions to the new ones. + // + // This is the order configs appear in the solution and what we want to rename them to: + // Debug|Any CPU = Debug|Any CPU -> ExportDebug|Any CPU = ExportDebug|Any CPU + // Tools|Any CPU = Tools|Any CPU -> Debug|Any CPU = Debug|Any CPU + // + // But we want to move Tools (now Debug) to the top, so it's easier to rename like this: + // Debug|Any CPU = Debug|Any CPU -> Debug|Any CPU = Debug|Any CPU + // Release|Any CPU = Release|Any CPU -> ExportDebug|Any CPU = ExportDebug|Any CPU + // Tools|Any CPU = Tools|Any CPU -> ExportRelease|Any CPU = ExportRelease|Any CPU + var dict = new Dictionary<string, string> { - {"Debug|Any CPU", "Tools|Any CPU"}, + {"Debug|Any CPU", "Debug|Any CPU"}, {"Release|Any CPU", "ExportDebug|Any CPU"}, {"Tools|Any CPU", "ExportRelease|Any CPU"} }; |