Skip to content

Commit

Permalink
Add version file for tool restoration
Browse files Browse the repository at this point in the history
  • Loading branch information
dellis1972 committed Oct 12, 2024
1 parent 19d250b commit 15aebb0
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions MonoGame.Framework.Content.Pipeline/ExternalTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,8 @@ public static int Run(string command, string arguments)
return result;
}

public static void RestoreDotnetTool(string command, string toolName)
public static void RestoreDotnetTool(string command, string toolName, string path)
{
string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory);
if (CurrentPlatform.OS == OS.Linux)
path= Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "linux");
if (CurrentPlatform.OS == OS.MacOSX)
path= Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "osx");
if (Directory.Exists (Path.Combine(path, toolName)))
return;
Directory.CreateDirectory(path);
Expand All @@ -58,8 +53,17 @@ public static void RestoreDotnetTool(string command, string toolName)

public static void RestoreDotnetTools()
{
RestoreDotnetTool("install", Crunch);
RestoreDotnetTool("install", BasisU);
var version = Assembly.GetExecutingAssembly().GetName().Version.ToString().Replace(".", "_");
string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory);
if (CurrentPlatform.OS == OS.Linux)
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")))
return;
RestoreDotnetTool("install", Crunch, path);
RestoreDotnetTool("install", BasisU, path);
File.WriteAllText(Path.Combine(path, $"tools_{version}.txt"), version);
}

/// <summary>
Expand Down

0 comments on commit 15aebb0

Please sign in to comment.