1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-26 02:14:22 +00:00

FileBasedDocument: Show correct error text in alert window if loadDocument fails

This commit is contained in:
reuk 2021-10-28 11:41:39 +01:00
parent cccb3d360a
commit 210cbdca66
No known key found for this signature in database
GPG key ID: 9ADCD339CFC98A11

View file

@ -326,7 +326,7 @@ private:
auto oldFile = documentFile;
documentFile = newFile;
auto tidyUp = [parent, newFile, oldFile, showMessageOnFailure, showWaitCursor, completed]
auto tidyUp = [parent, newFile, oldFile, showMessageOnFailure, showWaitCursor, completed] (Result result)
{
if (parent.shouldExitAsyncCallback())
return;
@ -336,8 +336,6 @@ private:
if (showWaitCursor)
MouseCursor::hideWaitCursor();
auto result = Result::fail (TRANS ("The file doesn't exist"));
if (showMessageOnFailure)
AlertWindow::showMessageBoxAsync (MessageBoxIconType::WarningIcon,
TRANS ("Failed to open file..."),
@ -373,7 +371,7 @@ private:
return;
}
tidyUp();
tidyUp (result);
};
doLoadDocument (newFile, std::move (afterLoading));
@ -381,7 +379,7 @@ private:
return;
}
tidyUp();
tidyUp (Result::fail (TRANS ("The file doesn't exist")));
}
//==============================================================================