Index: base/files/file_win.cc |
diff --git a/base/files/file_win.cc b/base/files/file_win.cc |
index 20c8908375c9b77b8a49d363410072b3861a8fb5..fd2b0da41e34488c48da996e971623d9953bb31a 100644 |
--- a/base/files/file_win.cc |
+++ b/base/files/file_win.cc |
@@ -273,6 +273,12 @@ File File::Duplicate() const { |
return other; |
} |
+bool File::DeleteOnClose(bool delete_on_close) { |
+ FILE_DISPOSITION_INFO disposition = {delete_on_close ? TRUE : FALSE}; |
+ return ::SetFileInformationByHandle(GetPlatformFile(), FileDispositionInfo, |
+ &disposition, sizeof(disposition)) != 0; |
+} |
+ |
// Static. |
File::Error File::OSErrorToFileError(DWORD last_error) { |
switch (last_error) { |
@@ -359,6 +365,8 @@ void File::DoInitialize(const FilePath& path, uint32_t flags) { |
access |= FILE_WRITE_ATTRIBUTES; |
if (flags & FLAG_EXECUTE) |
access |= GENERIC_EXECUTE; |
+ if (flags & FLAG_DELETE) |
+ access |= DELETE; |
DWORD sharing = (flags & FLAG_EXCLUSIVE_READ) ? 0 : FILE_SHARE_READ; |
if (!(flags & FLAG_EXCLUSIVE_WRITE)) |