mirror of
https://github.com/veracrypt/VeraCrypt
synced 2024-12-01 07:23:29 +01:00
Windows Setup: implement removal of non-empty directories to avoid errors during uninstall.
This commit is contained in:
parent
35497f87a7
commit
f98a691933
@ -101,7 +101,25 @@ BOOL StatRemoveDirectory (char *lpszDir)
|
|||||||
struct __stat64 st;
|
struct __stat64 st;
|
||||||
|
|
||||||
if (_stat64 (lpszDir, &st) == 0)
|
if (_stat64 (lpszDir, &st) == 0)
|
||||||
return RemoveDirectory (lpszDir);
|
{
|
||||||
|
BOOL bStatus = RemoveDirectory (lpszDir);
|
||||||
|
if (!bStatus)
|
||||||
|
{
|
||||||
|
/* force removal of the non empty directory */
|
||||||
|
char szOpPath[TC_MAX_PATH + 1] = {0};
|
||||||
|
SHFILEOPSTRUCTA op;
|
||||||
|
|
||||||
|
StringCbCopyA(szOpPath, sizeof(szOpPath)-1, lpszDir);
|
||||||
|
ZeroMemory(&op, sizeof(op));
|
||||||
|
op.wFunc = FO_DELETE;
|
||||||
|
op.pFrom = szOpPath;
|
||||||
|
op.fFlags = FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_NOCONFIRMMKDIR;
|
||||||
|
|
||||||
|
if ((0 == SHFileOperation(&op)) && (!op.fAnyOperationsAborted))
|
||||||
|
bStatus = TRUE;
|
||||||
|
}
|
||||||
|
return bStatus;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user