Closes SpartanJ/ecode#85.
Gracefully handle document save failing.
Fixed out of range access when editing files.
This commit is contained in:
Martín Lucas Golini
2023-03-19 19:42:29 -03:00
parent 13f2dce2ca
commit a231e4dd85
3 changed files with 19 additions and 5 deletions

View File

@@ -102,8 +102,17 @@ void App::saveDoc() {
return;
if ( mSplitter->getCurEditor()->getDocument().hasFilepath() ) {
if ( mSplitter->getCurEditor()->save() )
if ( mSplitter->getCurEditor()->save() ) {
updateEditorState();
} else {
UIMessageBox * msgBox = errorMsgBox( i18n(
"could_not_write_file", "Could not write file to disk.\nPlease check if the file "
"is read-only or if ecode does not have permissions to write to that file.\n"
"File path is: "
) + mSplitter->getCurEditor()->getDocument().getFilePath() );
setFocusEditorOnClose( msgBox );
}
} else {
saveFileDialog( mSplitter->getCurEditor() );
}