mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-25 14:54:39 +02:00
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",
|
int res = _nativeLangSpeaker.messageBox("FileBackupFailed",
|
||||||
_pPublicInterface->getHSelf(),
|
_pPublicInterface->getHSelf(),
|
||||||
|
@ -757,7 +757,7 @@ bool FileManager::moveFile(BufferID id, const TCHAR * newFileName)
|
|||||||
{
|
{
|
||||||
Buffer* buf = getBufferByID(id);
|
Buffer* buf = getBufferByID(id);
|
||||||
const TCHAR *fileNamePath = buf->getFullPathName();
|
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;
|
return false;
|
||||||
|
|
||||||
buf->setFileName(newFileName);
|
buf->setFileName(newFileName);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user