1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Projucer: Only close window if one was opened when creating a project from clipboard contents

This commit is contained in:
ed 2020-06-08 15:24:53 +01:00
parent 7f4b6e3288
commit 3536cf969f

View file

@ -1154,12 +1154,23 @@ void ProjucerApplication::createNewProjectFromClipboard()
tempFile.create();
tempFile.appendText (SystemClipboard::getTextFromClipboard());
if (! mainWindowList.openFile (tempFile))
String errorString;
if (! isPIPFile (tempFile))
{
AlertWindow::showMessageBoxAsync (AlertWindow::WarningIcon, "Error", "Couldn't create project from clipboard contents.");
tempFile.deleteFile();
errorString = "Clipboard does not contain a valid PIP.";
}
else if (! mainWindowList.openFile (tempFile))
{
errorString = "Couldn't create project from clipboard contents.";
mainWindowList.closeWindow (mainWindowList.windows.getLast());
}
if (errorString.isNotEmpty())
{
AlertWindow::showMessageBoxAsync (AlertWindow::WarningIcon, "Error", errorString);
tempFile.deleteFile();
}
}
void ProjucerApplication::createNewPIP()