Skip to content

Commit

Permalink
Automatically archive problem when VS project is deleted
Browse files Browse the repository at this point in the history
This was accidentally regressed by commit 2f8f459.
  • Loading branch information
slycelote committed Mar 7, 2022
1 parent 2df1d67 commit 8d6455b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion vscaide/VsCaideCore/VsCaideMainWindowControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -549,10 +549,20 @@ public void OnStartupProjectChanged(IProject newStartupProject)
// UI update will be done in fsWatcher callback.
}

public void OnBeforeCloseProject(IProject project)
public void OnBeforeDeleteProject(IProject project)
{
services.ThrowIfNotOnUIThread();
LogMethod();
if (IsCaideProblem(project.Name))
{
// Try to mitigate a mysterious error 'Unsatisified (sic!) constraints: folder not empty'.
Thread.Sleep(TimeSpan.FromSeconds(0.5));
CaideExe.Run("archive", project.Name);
string projectDirectory = Path.Combine(SolutionUtilities.GetSolutionDir(), project.Name);
if (Directory.Exists(projectDirectory))
Directory.Delete(projectDirectory, recursive: true);
SolutionUtilities.SaveSolution();
}
}

/************************
Expand Down
2 changes: 1 addition & 1 deletion vscaide/VsCaidePackage/VsCaidePackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ private void SolutionEvents_OnBeforeCloseProject(object sender, CloseProjectEven
ThreadHelper.ThrowIfNotOnUIThread();
if (e.IsRemoved && !SolutionUtilities.IgnoreSolutionEvents)
{
GetMainWindowControl()?.OnBeforeCloseProject(
GetMainWindowControl()?.OnBeforeDeleteProject(
VsImplementation.Services.GetProjectFromHierarchy(e.Hierarchy));
}
});
Expand Down

0 comments on commit 8d6455b

Please sign in to comment.