Fix regression: no error message when locked file could not be saved

Show file locked warning.
This is a regression from commit 469fa62c0e

Fix #9994, close #10487
This commit is contained in:
mere-human 2021-09-01 22:18:10 +03:00 committed by Don Ho
parent f428fbab13
commit 55f2644953
1 changed files with 11 additions and 2 deletions

View File

@ -569,9 +569,18 @@ bool Notepad_plus::doSave(BufferID id, const TCHAR * filename, bool isCopy)
}
else if (res == SavingStatus::SaveOpenFailed)
{
// try to open Notepad++ in admin mode
if (!_isAdministrator)
if (_isAdministrator)
{
// Already in admin mode? File is probably locked.
_nativeLangSpeaker.messageBox("FileLockedWarning",
_pPublicInterface->getHSelf(),
TEXT("Please check whether if this file is opened in another program"),
TEXT("Save failed"),
MB_OK | MB_ICONWARNING);
}
else
{
// try to open Notepad++ in admin mode
bool isSnapshotMode = NppParameters::getInstance().getNppGUI().isSnapshotMode();
if (isSnapshotMode) // if both rememberSession && backup mode are enabled
{ // Open the 2nd Notepad++ instance in Admin mode, then close the 1st instance.