[BUG_FIXED] (Author: Andreas Jonsson) Fix rename not replacing the existing file.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1184 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2014-02-21 08:11:48 +00:00
parent 7ce969dc74
commit 36fd69ee59

View File

@ -604,10 +604,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 (!PathFileExists(fileNamePath)) if (::MoveFileEx(fileNamePath, newFileName, MOVEFILE_REPLACE_EXISTING) == 0)
return false;
if (::MoveFile(fileNamePath, newFileName) == 0)
return false; return false;
buf->setFileName(newFileName); buf->setFileName(newFileName);