mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Windows: Add the FILE_SHARE_DELETE when opening file handles to allow them to be renamed and deleted
This commit is contained in:
parent
578022d011
commit
3b8686aa97
2 changed files with 22 additions and 2 deletions
|
|
@ -4,6 +4,26 @@ JUCE breaking changes
|
|||
Develop
|
||||
=======
|
||||
|
||||
Change
|
||||
-----
|
||||
Allow renaming and deletion of open file handles on Windows using the
|
||||
FILE_SHARE_DELETE flag.
|
||||
|
||||
Possible Issues
|
||||
---------------
|
||||
Previous code that relied on open files not being able to be renamed or
|
||||
deleted on Windows may fail.
|
||||
|
||||
Workaround
|
||||
----------
|
||||
No workaround.
|
||||
|
||||
Rationale
|
||||
---------
|
||||
This unifies the behaviour across OSes as POSIX systems already allow
|
||||
this.
|
||||
|
||||
|
||||
Change
|
||||
-----
|
||||
Multiple changes to low-level, non-public JNI and Android APIs.
|
||||
|
|
|
|||
|
|
@ -287,7 +287,7 @@ int64 juce_fileSetPosition (void* handle, int64 pos)
|
|||
void FileInputStream::openHandle()
|
||||
{
|
||||
auto h = CreateFile (file.getFullPathName().toWideCharPointer(),
|
||||
GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 0,
|
||||
GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, 0,
|
||||
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, 0);
|
||||
|
||||
if (h != INVALID_HANDLE_VALUE)
|
||||
|
|
@ -398,7 +398,7 @@ void MemoryMappedFile::openInternal (const File& file, AccessMode mode, bool exc
|
|||
}
|
||||
|
||||
auto h = CreateFile (file.getFullPathName().toWideCharPointer(), accessMode,
|
||||
exclusive ? 0 : (FILE_SHARE_READ | (mode == readWrite ? FILE_SHARE_WRITE : 0)), 0,
|
||||
exclusive ? 0 : (FILE_SHARE_READ | FILE_SHARE_DELETE | (mode == readWrite ? FILE_SHARE_WRITE : 0)), 0,
|
||||
createType, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, 0);
|
||||
|
||||
if (h != INVALID_HANDLE_VALUE)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue