Add session.xml.fail2Load for analyzing

When session.xml is written while Notepad++ exit, it'll be load for checking if it's an valid xml file.
If not, then it will be replaced by the old session file (if any).

This commit renames session.xml to session.xml.fail2Load so in case of the situation user can provide session.xml.fail2Load to devs for analyzing.

Ref #13694

Close #13741
This commit is contained in:
Don Ho 2023-06-05 01:41:14 +02:00
parent dba15cfaf3
commit ccf80a0699
1 changed files with 4 additions and 0 deletions

View File

@ -3596,6 +3596,10 @@ void NppParameters::writeSession(const Session & session, const TCHAR *fileName)
TEXT("The old session file will be restored."), TEXT("The old session file will be restored."),
TEXT("Error of saving session file"), TEXT("Error of saving session file"),
MB_OK | MB_APPLMODAL | MB_ICONWARNING); MB_OK | MB_APPLMODAL | MB_ICONWARNING);
wstring sessionPathNameFail2Load = sessionPathName;
sessionPathNameFail2Load += L".fail2Load";
MoveFileEx(sessionPathName, sessionPathNameFail2Load.c_str(), MOVEFILE_REPLACE_EXISTING);
CopyFile(backupPathName, sessionPathName, FALSE); CopyFile(backupPathName, sessionPathName, FALSE);
} }
} }