File::replaceInternal fails on Win10


#1

So I’m using the TemporaryFile class and overwriteTargetFileWithTemporary() is failing on Windows (it’s fine on MacOS)… so it looks like to get File::replaceInternal() to return true I had to change it to:

bool File::replaceInternal (const File& dest) const
{
    void* lpExclude = 0;
    void* lpReserved = 0;

    return ReplaceFile (dest.getFullPathName().toWideCharPointer(), fullPath.toWideCharPointer(),
                        0, REPLACEFILE_IGNORE_MERGE_ERRORS | REPLACEFILE_IGNORE_ACL_ERRORS, lpExclude, lpReserved) != 0;
}

I added the REPLACEFILE_IGNORE_ACL_ERRORS flag.

Rail


#2

Thanks @Rail_Jon_Rogut. We’ll add this to JUCE.


#3

Just ran into this myself. Glad it’s been brought up.


#4

This is fixed on develop with commit 3ebe75f.