Enhance copy/move file Win32API functions to avoid system cach
Suggestion from: https://github.com/d0vgan/nppexec/issues/29#issuecomment-761830889
This commit is contained in:
parent
45912a3321
commit
051b17ca44
|
@ -1566,7 +1566,8 @@ bool Notepad_plus::fileSave(BufferID id)
|
|||
}
|
||||
}
|
||||
|
||||
if (!::CopyFile(fn, fn_bak.c_str(), FALSE))
|
||||
BOOL keepGoing = TRUE;
|
||||
if (!::CopyFileEx(fn, fn_bak.c_str(), nullptr, nullptr, &keepGoing, COPY_FILE_NO_BUFFERING))
|
||||
{
|
||||
int res = _nativeLangSpeaker.messageBox("FileBackupFailed",
|
||||
_pPublicInterface->getHSelf(),
|
||||
|
|
|
@ -757,7 +757,7 @@ bool FileManager::moveFile(BufferID id, const TCHAR * newFileName)
|
|||
{
|
||||
Buffer* buf = getBufferByID(id);
|
||||
const TCHAR *fileNamePath = buf->getFullPathName();
|
||||
if (::MoveFileEx(fileNamePath, newFileName, MOVEFILE_REPLACE_EXISTING | MOVEFILE_COPY_ALLOWED) == 0)
|
||||
if (::MoveFileEx(fileNamePath, newFileName, MOVEFILE_REPLACE_EXISTING | MOVEFILE_COPY_ALLOWED | MOVEFILE_WRITE_THROUGH) == 0)
|
||||
return false;
|
||||
|
||||
buf->setFileName(newFileName);
|
||||
|
|
Loading…
Reference in New Issue