diff --git a/extras/Projucer/Source/Application/jucer_Application.cpp b/extras/Projucer/Source/Application/jucer_Application.cpp index f6f89cab22..56d22e4baf 100644 --- a/extras/Projucer/Source/Application/jucer_Application.cpp +++ b/extras/Projucer/Source/Application/jucer_Application.cpp @@ -100,6 +100,8 @@ void ProjucerApplication::initialise (const String& commandLine) return; } + doBasicApplicationSetup(); + // do further initialisation in a moment when the message loop has started triggerAsyncUpdate(); } @@ -130,7 +132,7 @@ void ProjucerApplication::initialiseWindows (const String& commandLine) if (commandLineWithoutNSDebug.trim().isNotEmpty() && ! commandLineWithoutNSDebug.trim().startsWithChar ('-')) anotherInstanceStarted (commandLine); - else + else if (mainWindowList.windows.size() == 0) mainWindowList.reopenLastProjects(); mainWindowList.createWindowIfNoneAreOpen(); @@ -138,17 +140,11 @@ void ProjucerApplication::initialiseWindows (const String& commandLine) void ProjucerApplication::handleAsyncUpdate() { - licenseController = std::make_unique(); - - LookAndFeel::setDefaultLookAndFeel (&lookAndFeel); - rescanJUCEPathModules(); rescanUserPathModules(); openDocumentManager.registerType (new ProjucerAppClasses::LiveBuildCodeEditorDocument::Type(), 2); - childProcessCache.reset (new ChildProcessCache()); - initCommandManager(); menuModel.reset (new MainMenuModel()); #if JUCE_MAC @@ -162,7 +158,6 @@ void ProjucerApplication::handleAsyncUpdate() updateEditorColourSchemeIfNeeded(); ImageCache::setCacheTimeout (30 * 1000); - icons = std::make_unique(); tooltipWindow = std::make_unique (nullptr, 1200); if (isAutomaticVersionCheckingEnabled()) @@ -171,6 +166,15 @@ void ProjucerApplication::handleAsyncUpdate() initialiseWindows (getCommandLineParameters()); } +void ProjucerApplication::doBasicApplicationSetup() +{ + licenseController = std::make_unique(); + LookAndFeel::setDefaultLookAndFeel (&lookAndFeel); + initCommandManager(); + childProcessCache = std::make_unique(); + icons = std::make_unique(); +} + static void deleteTemporaryFiles() { auto tempDirectory = File::getSpecialLocation (File::SpecialLocationType::tempDirectory).getChildFile ("PIPs"); @@ -272,7 +276,12 @@ String ProjucerApplication::getVersionDescription() const void ProjucerApplication::anotherInstanceStarted (const String& commandLine) { if (server == nullptr && ! commandLine.trim().startsWithChar ('-')) - openFile (File (commandLine.unquoted())); + { + ArgumentList list ({}, commandLine); + + for (auto& arg : list.arguments) + openFile (arg.resolveAsFile()); + } } ProjucerApplication& ProjucerApplication::getApp() @@ -1195,7 +1204,6 @@ void ProjucerApplication::askUserToOpenFile() bool ProjucerApplication::openFile (const File& file) { - handleUpdateNowIfNeeded(); return mainWindowList.openFile (file); } diff --git a/extras/Projucer/Source/Application/jucer_Application.h b/extras/Projucer/Source/Application/jucer_Application.h index a7f80d717d..038b4ac071 100644 --- a/extras/Projucer/Source/Application/jucer_Application.h +++ b/extras/Projucer/Source/Application/jucer_Application.h @@ -112,6 +112,7 @@ public: private: //============================================================================== void handleAsyncUpdate() override; + void doBasicApplicationSetup(); void initCommandManager(); bool initialiseLogger (const char* filePrefix);