PartialityModding / PartialityLauncher

The launcher for Partiality.
MIT License
26 stars 17 forks source link

Fix uninstallation #12

Closed benediktwerner closed 1 year ago

benediktwerner commented 3 years ago

Using the "Uninstall Partiality" button consistently fails for me.

The problem seems to be that Directory.Delete is not synchronous. When the Managed directory is deleted it can take some time to complete, causing its immediate recreation to happen too early which ultimately leads to there not being a Managed directory when Partiality starts to copy over files from the backup directory which then causes an exception and crashes the launcher.

See for example also this stack overflow post: https://stackoverflow.com/questions/35069311/why-sometimes-directory-createdirectory-fails

This PR should fix the problem by ensuring the directory is really deleted before recreating it.