@@ -280,13 +280,6 @@ public: | |||||
// Deleting the .rsrc files can be needed to force Xcode to update the version number. | // Deleting the .rsrc files can be needed to force Xcode to update the version number. | ||||
deleteRsrcFiles (getTargetFolder().getChildFile ("build")); | deleteRsrcFiles (getTargetFolder().getChildFile ("build")); | ||||
if (! ProjucerApplication::getApp().isRunningCommandLine) | |||||
{ | |||||
// Workaround for a bug where Xcode thinks the project is invalid if opened immedietely | |||||
// after writing | |||||
Thread::sleep (2000); | |||||
} | |||||
} | } | ||||
//============================================================================== | //============================================================================== | ||||
@@ -48,28 +48,29 @@ public: | |||||
struct SaveThread : public ThreadWithProgressWindow | struct SaveThread : public ThreadWithProgressWindow | ||||
{ | { | ||||
public: | public: | ||||
SaveThread (ProjectSaver& ps) | |||||
SaveThread (ProjectSaver& ps, bool wait = false) | |||||
: ThreadWithProgressWindow ("Saving...", true, false), | : ThreadWithProgressWindow ("Saving...", true, false), | ||||
saver (ps), result (Result::ok()) | |||||
saver (ps), result (Result::ok()), shouldWaitAfterSaving (wait) | |||||
{} | {} | ||||
void run() override | void run() override | ||||
{ | { | ||||
setProgress (-1); | setProgress (-1); | ||||
result = saver.save (false); | |||||
result = saver.save (false, shouldWaitAfterSaving); | |||||
} | } | ||||
ProjectSaver& saver; | ProjectSaver& saver; | ||||
Result result; | Result result; | ||||
bool shouldWaitAfterSaving; | |||||
JUCE_DECLARE_NON_COPYABLE (SaveThread) | JUCE_DECLARE_NON_COPYABLE (SaveThread) | ||||
}; | }; | ||||
Result save (bool showProgressBox) | |||||
Result save (bool showProgressBox, bool waitAfterSaving) | |||||
{ | { | ||||
if (showProgressBox) | if (showProgressBox) | ||||
{ | { | ||||
SaveThread thread (*this); | |||||
SaveThread thread (*this, waitAfterSaving); | |||||
thread.runThread(); | thread.runThread(); | ||||
return thread.result; | return thread.result; | ||||
} | } | ||||
@@ -109,6 +110,11 @@ public: | |||||
return Result::fail (errors[0]); | return Result::fail (errors[0]); | ||||
} | } | ||||
// Workaround for a bug where Xcode thinks the project is invalid if opened immedietely | |||||
// after writing | |||||
if (waitAfterSaving) | |||||
Thread::sleep (2000); | |||||
return Result::ok(); | return Result::ok(); | ||||
} | } | ||||
@@ -383,7 +383,7 @@ Result Project::saveProject (const File& file, bool isCommandLineApp) | |||||
const ScopedValueSetter<bool> vs (isSaving, true, false); | const ScopedValueSetter<bool> vs (isSaving, true, false); | ||||
ProjectSaver saver (*this, file); | ProjectSaver saver (*this, file); | ||||
return saver.save (! isCommandLineApp); | |||||
return saver.save (! isCommandLineApp, shouldWaitAfterSaving); | |||||
} | } | ||||
Result Project::saveResourcesOnly (const File& file) | Result Project::saveResourcesOnly (const File& file) | ||||
@@ -341,6 +341,9 @@ public: | |||||
bool hasProjectBeenModified(); | bool hasProjectBeenModified(); | ||||
void updateModificationTime() { modificationTime = getFile().getLastModificationTime(); } | void updateModificationTime() { modificationTime = getFile().getLastModificationTime(); } | ||||
//============================================================================== | |||||
bool shouldWaitAfterSaving = false; | |||||
private: | private: | ||||
//============================================================================== | //============================================================================== | ||||
void setMissingAudioPluginDefaultValues(); | void setMissingAudioPluginDefaultValues(); | ||||
@@ -628,10 +628,15 @@ bool ProjectContentComponent::goToCounterpart() | |||||
return false; | return false; | ||||
} | } | ||||
bool ProjectContentComponent::saveProject() | |||||
bool ProjectContentComponent::saveProject (bool shouldWait) | |||||
{ | { | ||||
return project != nullptr | |||||
&& project->save (true, true) == FileBasedDocument::savedOk; | |||||
if (project != nullptr) | |||||
{ | |||||
const ScopedValueSetter<bool> valueSetter (project->shouldWaitAfterSaving, shouldWait, false); | |||||
return (project->save (true, true) == FileBasedDocument::savedOk); | |||||
} | |||||
return false; | |||||
} | } | ||||
void ProjectContentComponent::closeProject() | void ProjectContentComponent::closeProject() | ||||
@@ -737,7 +742,7 @@ void ProjectContentComponent::openInSelectedIDE (bool saveFirst) | |||||
if (exporter->canLaunchProject() && exporter->getName() == selectedIDE) | if (exporter->canLaunchProject() && exporter->getName() == selectedIDE) | ||||
{ | { | ||||
if (saveFirst) | if (saveFirst) | ||||
saveProject(); | |||||
saveProject (exporter->isXcode()); | |||||
exporter->launchProject(); | exporter->launchProject(); | ||||
break; | break; | ||||
@@ -75,7 +75,7 @@ public: | |||||
bool canGoToCounterpart() const; | bool canGoToCounterpart() const; | ||||
bool goToCounterpart(); | bool goToCounterpart(); | ||||
bool saveProject(); | |||||
bool saveProject (bool shouldWait = false); | |||||
void closeProject(); | void closeProject(); | ||||
void openInSelectedIDE (bool saveFirst); | void openInSelectedIDE (bool saveFirst); | ||||
void showNewExporterMenu(); | void showNewExporterMenu(); | ||||