diff --git a/PowerEditor/src/Notepad_plus_Window.cpp b/PowerEditor/src/Notepad_plus_Window.cpp index 304af9960..4ea0622a0 100644 --- a/PowerEditor/src/Notepad_plus_Window.cpp +++ b/PowerEditor/src/Notepad_plus_Window.cpp @@ -223,8 +223,13 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin ::MessageBoxA(NULL, dest, "", MB_OK); } - // Lauch backup task - _notepad_plus_plus_core.launchDocumentBackupTask(); + bool doBackup = true; + if (doBackup) + { + _notepad_plus_plus_core.checkModifiedDocument(); + // Lauch backup task + _notepad_plus_plus_core.launchDocumentBackupTask(); + } } bool Notepad_plus_Window::isDlgsMsg(MSG *msg, bool unicodeSupported) const diff --git a/PowerEditor/src/NppIO.cpp b/PowerEditor/src/NppIO.cpp index 405fb84e8..8db2f77fc 100644 --- a/PowerEditor/src/NppIO.cpp +++ b/PowerEditor/src/NppIO.cpp @@ -1404,7 +1404,7 @@ bool Notepad_plus::loadSession(Session & session, bool isBackupMode) if (session._mainViewFiles[i]._encoding != -1) buf->setEncoding(session._mainViewFiles[i]._encoding); - if (isBackupMode && session._mainViewFiles[i]._backupFilePath != TEXT("")) + if (isBackupMode && session._mainViewFiles[i]._backupFilePath != TEXT("") && PathFileExists(session._mainViewFiles[i]._backupFilePath.c_str())) buf->setDirty(true); //Force in the document so we can add the markers @@ -1511,7 +1511,7 @@ bool Notepad_plus::loadSession(Session & session, bool isBackupMode) buf->setLangType(typeToSet, pLn); buf->setEncoding(session._subViewFiles[k]._encoding); - if (isBackupMode && session._mainViewFiles[i]._backupFilePath != TEXT("")) + if (isBackupMode && session._subViewFiles[i]._backupFilePath != TEXT("") && PathFileExists(session._subViewFiles[i]._backupFilePath.c_str())) buf->setDirty(true); //Force in the document so we can add the markers