Skip to content

Commit

Permalink
Clean-up Choreo if previously installed (#485)
Browse files Browse the repository at this point in the history
  • Loading branch information
sciencewhiz authored Dec 17, 2024
1 parent 856bc83 commit bdd101a
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions WPILibInstaller-Avalonia/ViewModels/InstallPageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ private async Task InstallEverything(CancellationToken token)
ProgressTotal = 88;
TextTotal = "Creating Shortcuts";
await RunShortcutCreator(token);
if (token.IsCancellationRequested) break;
ProgressTotal = 99;
TextTotal = "Cleaning Up";
await RunChoreoCleanup();
} while (false);
}
catch (OperationCanceledException)
Expand Down Expand Up @@ -982,5 +986,27 @@ await Task.Run(() =>
}, token);
}
}

private async Task RunChoreoCleanup()
{
if (Directory.Exists(Path.Combine(configurationProvider.InstallDirectory, "choreo")))
{
Text = "Clean up Choreo Directory";
Progress = 25;
Directory.Delete(Path.Combine(configurationProvider.InstallDirectory, "choreo"), true);

Text = "Clean up Choreo Scripts";
Progress = 50;
File.Delete(Path.Combine(configurationProvider.InstallDirectory, "tools", "choreo.vbs"));
File.Delete(Path.Combine(configurationProvider.InstallDirectory, "tools", "choreo.sh"));

Text = "Clean up Choreo Vendordeps";
Progress = 75;
File.Delete(Path.Combine(configurationProvider.InstallDirectory, "vendordeps", "ChoreoLib2025Beta.json"));
}

await Task.Yield();
}

}
}

0 comments on commit bdd101a

Please sign in to comment.