86Box/86BoxManager

86BoxManager crashes after trying to delete a VM with read-only files in the directory

1ahmadbassam opened this issue · 2 comments

Attempting to delete a VM with some read-only or protected (in use) files in the directory causes the manager to crash. For instance, I installed Windows 3.11 and extracted the disk to a directory but deleting the VM yields a crash.
************** Exception Text **************
System.UnauthorizedAccessException: Access to the path 'IO.SYS' is denied.
at System.IO.Directory.DeleteHelper(String fullPath, String userPath, Boolean recursive, Boolean throwOnTopLevelDirectoryNotFound, WIN32_FIND_DATA& data)
at System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive, Boolean checkHost)
at _86boxManager.frmMain.VMRemove()
at _86boxManager.frmMain.btnDelete_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

exception

I'll fix this so it's handled properly, but common sense also applies here - don't try to delete things that are in use or read-only. The VM directory should be writeable and not in use, same goes for everything inside as well.

This has been fixed in version 1.5.1.