diff --git a/extras/Projucer/Source/Application/jucer_Application.cpp b/extras/Projucer/Source/Application/jucer_Application.cpp index 5d5460fdc4..67a157659a 100644 --- a/extras/Projucer/Source/Application/jucer_Application.cpp +++ b/extras/Projucer/Source/Application/jucer_Application.cpp @@ -136,12 +136,6 @@ void ProjucerApplication::initialiseBasics() ImageCache::setCacheTimeout (30 * 1000); icons.reset (new Icons()); tooltipWindow.setMillisecondsBeforeTipAppears (1200); - - if (isRunningCommandLine) - { - rescanJUCEPathModules(); - rescanUserPathModules(); - } } bool ProjucerApplication::initialiseLogger (const char* filePrefix) diff --git a/extras/Projucer/Source/Application/jucer_CommandLine.cpp b/extras/Projucer/Source/Application/jucer_CommandLine.cpp index 9e2b2ec22b..8b0d33d44a 100644 --- a/extras/Projucer/Source/Application/jucer_CommandLine.cpp +++ b/extras/Projucer/Source/Application/jucer_CommandLine.cpp @@ -25,9 +25,8 @@ */ #include "jucer_Headers.h" -#include "../Project/jucer_Module.h" +#include "jucer_Application.h" #include "../Utility/Helpers/jucer_TranslationHelpers.h" -#include "../Utility/PIPs/jucer_PIPGenerator.h" #include "jucer_CommandLine.h" @@ -94,6 +93,9 @@ namespace { if (project != nullptr) { + if (! justSaveResources) + rescanModulePathsIfNecessary(); + auto error = justSaveResources ? project->saveResourcesOnly (project->getFile()) : project->saveProject (project->getFile(), true); @@ -104,6 +106,35 @@ namespace } } + void rescanModulePathsIfNecessary() + { + bool scanJUCEPath = false, scanUserPaths = false; + + const auto& modules = project->getEnabledModules(); + + for (auto i = modules.getNumModules(); --i >= 0;) + { + const auto& id = modules.getModuleID (i); + + if (isJUCEModule (id) && ! scanJUCEPath) + { + if (modules.shouldUseGlobalPath (id)) + scanJUCEPath = true; + } + else if (! scanUserPaths) + { + if (modules.shouldUseGlobalPath (id)) + scanUserPaths = true; + } + } + + if (scanJUCEPath) + ProjucerApplication::getApp().rescanJUCEPathModules(); + + if (scanUserPaths) + ProjucerApplication::getApp().rescanUserPathModules(); + } + std::unique_ptr project; };