1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-01 03:10:06 +00:00

Projucer: Only scan module paths on command-line when re-saving projects using global paths

This commit is contained in:
ed 2018-09-10 14:56:45 +01:00
parent e1e3b42b4f
commit 856d7dc333
2 changed files with 33 additions and 8 deletions

View file

@ -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> project;
};