diff options
-rw-r--r-- | base/file_util_win.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/base/file_util_win.cc b/base/file_util_win.cc index 4645acc..3ca52ae 100644 --- a/base/file_util_win.cc +++ b/base/file_util_win.cc @@ -163,6 +163,14 @@ bool Delete(const FilePath& path, bool recursive) { if (!recursive) file_operation.fFlags |= FOF_NORECURSION | FOF_FILESONLY; int err = SHFileOperation(&file_operation); + + // Since we're passing flags to the operation telling it to be silent, + // it's possible for the operation to be aborted/cancelled without err + // being set (although MSDN doesn't give any scenarios for how this can + // happen). See MSDN for SHFileOperation and SHFILEOPTSTRUCT. + if (file_operation.fAnyOperationsAborted) + return false; + // Some versions of Windows return ERROR_FILE_NOT_FOUND (0x2) when deleting // an empty directory and some return 0x402 when they should be returning // ERROR_FILE_NOT_FOUND. MSDN says Vista and up won't return 0x402. |