mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Projucer: Fix temporary project save/open in Xcode on Monterey
Previously, when saving a temporary project, two native dialogs would be created. The first was very short-lived, as it was automatically dismissed by the second dialog. On older macOS versions, this appeared to work correctly (the first dialog was so short-lived that it did not appear to the user). However, on macOS 12.0, the second dialog fails to display altogether. Displaying two file chooser dialogs feels like a programming error, so the code has been reorganised a bit to avoid this case.
This commit is contained in:
parent
4196b5e45b
commit
540001365c
3 changed files with 20 additions and 10 deletions
|
|
@ -400,7 +400,12 @@ bool ProjectContentComponent::goToCounterpart()
|
|||
|
||||
void ProjectContentComponent::saveProjectAsync()
|
||||
{
|
||||
if (project != nullptr)
|
||||
if (project == nullptr)
|
||||
return;
|
||||
|
||||
if (project->isTemporaryProject())
|
||||
project->saveAndMoveTemporaryProject (false);
|
||||
else
|
||||
project->saveAsync (true, true, nullptr);
|
||||
}
|
||||
|
||||
|
|
@ -501,6 +506,12 @@ void ProjectContentComponent::openInSelectedIDE (bool saveFirst)
|
|||
{
|
||||
if (saveFirst)
|
||||
{
|
||||
if (project->isTemporaryProject())
|
||||
{
|
||||
project->saveAndMoveTemporaryProject (true);
|
||||
return;
|
||||
}
|
||||
|
||||
SafePointer<ProjectContentComponent> safeThis { this };
|
||||
project->saveAsync (true, true, [safeThis] (Project::SaveResult r)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -700,15 +700,17 @@ void Project::saveProject (Async async,
|
|||
return;
|
||||
}
|
||||
|
||||
if (saver != nullptr)
|
||||
if (isTemporaryProject())
|
||||
{
|
||||
onCompletion (Result::ok());
|
||||
// Don't try to save a temporary project directly. Instead, check whether the
|
||||
// project is temporary before saving it, and call saveAndMoveTemporaryProject
|
||||
// in that case.
|
||||
onCompletion (Result::fail ("Cannot save temporary project."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (isTemporaryProject())
|
||||
if (saver != nullptr)
|
||||
{
|
||||
saveAndMoveTemporaryProject (false);
|
||||
onCompletion (Result::ok());
|
||||
return;
|
||||
}
|
||||
|
|
@ -731,9 +733,7 @@ void Project::saveProject (Async async,
|
|||
return;
|
||||
|
||||
ref->saver = nullptr;
|
||||
|
||||
if (onCompletion != nullptr)
|
||||
onCompletion (result);
|
||||
NullCheckedInvocation::invoke (onCompletion, result);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -131,6 +131,7 @@ public:
|
|||
void saveDocumentAsync (const File& file, std::function<void (Result)> callback) override;
|
||||
|
||||
void saveProject (Async, ProjectExporter* exporterToSave, std::function<void (Result)> onCompletion);
|
||||
void saveAndMoveTemporaryProject (bool openInIDE);
|
||||
Result saveResourcesOnly();
|
||||
void openProjectInIDE (ProjectExporter& exporterToOpen);
|
||||
|
||||
|
|
@ -577,8 +578,6 @@ private:
|
|||
File tempDirectory;
|
||||
std::pair<Time, String> cachedFileState;
|
||||
|
||||
void saveAndMoveTemporaryProject (bool openInIDE);
|
||||
|
||||
//==============================================================================
|
||||
friend class Item;
|
||||
StringPairArray parsedPreprocessorDefs;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue