From d57255e1f4d1e363c9aa9df72efa7660583c9aba Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Tue, 21 Jan 2025 21:07:07 -0600 Subject: [PATCH] Delete tool folder before installing helps clear out any stale previous installation attempts --- .../Services/Singletons/ConstructDotNetToolEndpoint.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Spriggit.Engine/Services/Singletons/ConstructDotNetToolEndpoint.cs b/Spriggit.Engine/Services/Singletons/ConstructDotNetToolEndpoint.cs index 3a65f87..dd07684 100644 --- a/Spriggit.Engine/Services/Singletons/ConstructDotNetToolEndpoint.cs +++ b/Spriggit.Engine/Services/Singletons/ConstructDotNetToolEndpoint.cs @@ -1,4 +1,5 @@ using System.Diagnostics; +using System.IO.Abstractions; using Noggog; using Noggog.Processes.DI; using NuGet.Packaging.Core; @@ -9,17 +10,20 @@ namespace Spriggit.Engine.Services.Singletons; public class ConstructDotNetToolEndpoint { private readonly ILogger _logger; + private readonly IFileSystem _fileSystem; private readonly ProcessFactory _processFactory; private readonly DotNetToolTranslationPackagePathProvider _pathProvider; private readonly SpriggitTempSourcesProvider _tempSourcesProvider; public ConstructDotNetToolEndpoint( ILogger logger, + IFileSystem fileSystem, ProcessFactory processFactory, DotNetToolTranslationPackagePathProvider pathProvider, SpriggitTempSourcesProvider tempSourcesProvider) { _logger = logger; + _fileSystem = fileSystem; _processFactory = processFactory; _pathProvider = pathProvider; _tempSourcesProvider = tempSourcesProvider; @@ -65,6 +69,7 @@ private async Task IsToolInstalled( { try { + _fileSystem.Directory.DeleteEntireFolder(toolsPath); var args = $"tool install {ident.Id} --version {ident.Version} --tool-path \"{toolsPath}\""; _logger.Information("Running DotNet Entry point install with Args: {Args}", args); using var processWrapper = _processFactory.Create(