1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Projucer: Fixed a bug where modules added from the global user module path weren't being added to generated projects correctly

This commit is contained in:
ed 2017-07-03 16:35:03 +01:00
parent aef6a296e0
commit 2540725b6a
3 changed files with 21 additions and 23 deletions

View file

@ -507,9 +507,7 @@ String ProjectExporter::getPathForModuleString (const String& moduleID) const
if (id == Ids::defaultJuceModulePath)
return getAppSettings().getStoredPath (Ids::defaultJuceModulePath).toString();
return EnabledModuleList::findUserModuleFolder (moduleID,
getAppSettings().getStoredPath (Ids::defaultUserModulePath).toString(),
project).getFullPathName();
return getAppSettings().getStoredPath (Ids::defaultUserModulePath).toString();
}
return exporterPath;

View file

@ -684,6 +684,24 @@ File EnabledModuleList::getModuleFolderFromPathIfItExists (const String& path, c
return {};
}
File EnabledModuleList::findUserModuleFolder (const String& possiblePaths, const String& moduleID)
{
auto paths = StringArray::fromTokens (possiblePaths, ";", {});
for (auto p : paths)
{
auto f = File::createFileWithoutCheckingPath (p.trim());
if (f.exists())
{
auto moduleFolder = getModuleFolderFromPathIfItExists (f.getFullPathName(), moduleID, project);
if (moduleFolder != File())
return moduleFolder;
}
}
return {};
}
File EnabledModuleList::getModuleFolder (const String& moduleID)
{
if (shouldUseGlobalPath (moduleID).getValue())
@ -691,7 +709,7 @@ File EnabledModuleList::getModuleFolder (const String& moduleID)
if (isJuceModule (moduleID))
return getModuleFolderFromPathIfItExists (getAppSettings().getStoredPath (Ids::defaultJuceModulePath).toString(), moduleID, project);
return findUserModuleFolder (moduleID, getAppSettings().getStoredPath (Ids::defaultUserModulePath).toString(), project);
return findUserModuleFolder (moduleID, getAppSettings().getStoredPath (Ids::defaultUserModulePath).toString());
}
auto paths = getAllPossibleModulePathsFromExporters (project);
@ -874,24 +892,6 @@ File EnabledModuleList::findDefaultModulesFolder (Project& project)
return File::getCurrentWorkingDirectory();
}
File EnabledModuleList::findUserModuleFolder (const String& moduleID, const String& possiblePaths, const Project& project)
{
auto paths = StringArray::fromTokens (possiblePaths, ";", {});
for (auto p : paths)
{
auto f = File::createFileWithoutCheckingPath (p.trim());
if (f.exists())
{
auto moduleFolder = getModuleFolderFromPathIfItExists (f.getFullPathName(), moduleID, project);
if (moduleFolder != File())
return moduleFolder;
}
}
return {};
}
bool EnabledModuleList::isJuceModule (const String& moduleID)
{
static StringArray juceModuleIds =

View file

@ -138,7 +138,6 @@ public:
static File findGlobalModulesFolder();
static File findDefaultModulesFolder (Project&);
static File findUserModuleFolder (const String& moduleID, const String& possiblePaths, const Project&);
static bool isJuceModule (const String& moduleID);
bool isModuleEnabled (const String& moduleID) const;
@ -179,6 +178,7 @@ private:
UndoManager* getUndoManager() const { return project.getUndoManagerFor (state); }
static File getModuleFolderFromPathIfItExists (const String& path, const String& moduleID, const Project&);
File findUserModuleFolder (const String& possiblePaths, const String& moduleID);
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (EnabledModuleList)
};