From 8f1036eece41736ab5f73b08a04509ad82aef061 Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Sat, 12 Oct 2024 19:42:31 +0100 Subject: [PATCH] Check version file --- MonoGame.Framework.Content.Pipeline/ExternalTool.cs | 5 +++-- .../Common/PipelineController.cs | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/MonoGame.Framework.Content.Pipeline/ExternalTool.cs b/MonoGame.Framework.Content.Pipeline/ExternalTool.cs index ca184dd4e93..de52731a448 100644 --- a/MonoGame.Framework.Content.Pipeline/ExternalTool.cs +++ b/MonoGame.Framework.Content.Pipeline/ExternalTool.cs @@ -58,11 +58,12 @@ public static void RestoreDotnetTools() path= Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "linux"); if (CurrentPlatform.OS == OS.MacOSX) path= Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "osx"); - if (File.Exists(Path.Combine(path, $"tools_{version}.txt"))) + var versionFile = Path.Combine(path, $"tools_version.txt"); + if (File.Exists(versionFile) && File.ReadAllText (versionFile) == version) return; RestoreDotnetTool("install", Crunch, CrunchVersion, path); RestoreDotnetTool("install", BasisU, BasisUVersion, path); - File.WriteAllText(Path.Combine(path, $"tools_{version}.txt"), version); + File.WriteAllText(versionFile, version); } /// diff --git a/Tools/MonoGame.Content.Builder.Editor/Common/PipelineController.cs b/Tools/MonoGame.Content.Builder.Editor/Common/PipelineController.cs index 1308e0052de..e5e58858e7f 100644 --- a/Tools/MonoGame.Content.Builder.Editor/Common/PipelineController.cs +++ b/Tools/MonoGame.Content.Builder.Editor/Common/PipelineController.cs @@ -585,6 +585,8 @@ private void RestoreMGCB() var appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); var version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); var workingDirectory = Path.Combine(appDataPath, "mgcb-dotnet-tool", version); + if (Directory.Exists(workingDirectory)) + return; Directory.CreateDirectory(workingDirectory); var dotnet = Global.Unix ? "dotnet" : "dotnet.exe"; if (Util.Run(dotnet, $"tool install dotnet-mgcb --version {version} --tool-path .", workingDirectory) != 0)