Skip to content

Commit

Permalink
Win32 FS: Always use FILE_SHARE_DELETE
Browse files Browse the repository at this point in the history
  • Loading branch information
elad335 committed Sep 15, 2020
1 parent f7deae4 commit 2c5be0c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Utilities/File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -941,15 +941,15 @@ fs::file::file(const std::string& path, bs_t<open_mode> mode)
disp = mode & fs::trunc ? TRUNCATE_EXISTING : OPEN_EXISTING;
}

DWORD share = 0;
DWORD share = FILE_SHARE_DELETE;
if (!(mode & fs::unread) || !(mode & fs::write))
{
share |= FILE_SHARE_READ;
}

if (!(mode & (fs::lock + fs::unread)) || !(mode & fs::write))
{
share |= FILE_SHARE_WRITE | FILE_SHARE_DELETE;
share |= FILE_SHARE_WRITE;
}

const HANDLE handle = CreateFileW(to_wchar(path).get(), access, share, NULL, disp, FILE_ATTRIBUTE_NORMAL, NULL);
Expand Down

0 comments on commit 2c5be0c

Please sign in to comment.