Skip to content

Commit

Permalink
Clean-up Choreo if previously installed
Browse files Browse the repository at this point in the history
  • Loading branch information
sciencewhiz committed Dec 17, 2024
1 parent a62c1f1 commit 252b4f9
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 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 @@ -984,5 +988,26 @@ 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 252b4f9

Please sign in to comment.