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

Projucer: Use relative paths for PIP includes and modules if project isn't temporary

This commit is contained in:
ed 2018-11-27 16:40:58 +00:00
parent 5b9f834fb3
commit 7b09d14695
2 changed files with 19 additions and 7 deletions

View file

@ -228,7 +228,7 @@ ValueTree PIPGenerator::createModulePathChild (const String& moduleID)
ValueTree modulePath (Ids::MODULEPATH);
modulePath.setProperty (Ids::ID, moduleID, nullptr);
modulePath.setProperty (Ids::path, getPathForModule (moduleID).getFullPathName(), nullptr);
modulePath.setProperty (Ids::path, getPathForModule (moduleID), nullptr);
return modulePath;
}
@ -300,7 +300,7 @@ ValueTree PIPGenerator::createModuleChild (const String& moduleID)
module.setProperty (Ids::ID, moduleID, nullptr);
module.setProperty (Ids::showAllCode, 1, nullptr);
module.setProperty (Ids::useLocalCopy, 0, nullptr);
module.setProperty (Ids::useGlobalPath, (getPathForModule (moduleID) == File() ? 1 : 0), nullptr);
module.setProperty (Ids::useGlobalPath, (getPathForModule (moduleID).isEmpty() ? 1 : 0), nullptr);
return module;
}
@ -426,7 +426,9 @@ String PIPGenerator::getMainFileTextForType()
String mainTemplate (BinaryData::jucer_PIPMain_cpp);
mainTemplate = mainTemplate.replace ("%%filename%%", useLocalCopy ? pipFile.getFileName()
: pipFile.getFullPathName());
: isTemp ? pipFile.getFullPathName()
: RelativePath (pipFile, outputDirectory.getChildFile ("Source"),
RelativePath::unknown).toUnixStyle());
auto type = metadata[Ids::type].toString();
@ -529,16 +531,26 @@ StringArray PIPGenerator::getPluginCharacteristics() const
return {};
}
File PIPGenerator::getPathForModule (const String& moduleID) const
String PIPGenerator::getPathForModule (const String& moduleID) const
{
if (isJUCEModule (moduleID))
{
if (juceModulesPath != File())
return juceModulesPath;
{
if (isTemp)
return juceModulesPath.getFullPathName();
return RelativePath (juceModulesPath, outputDirectory, RelativePath::projectFolder).toUnixStyle();
}
}
else if (availableUserModules != nullptr)
{
return availableUserModules->getModuleWithID (moduleID).second.getParentDirectory();
auto moduleRoot = availableUserModules->getModuleWithID (moduleID).second.getParentDirectory();
if (isTemp)
return moduleRoot.getFullPathName();
return RelativePath (moduleRoot , outputDirectory, RelativePath::projectFolder).toUnixStyle();
}
return {};

View file

@ -74,7 +74,7 @@ private:
StringArray getExtraPluginFormatsToBuild() const;
StringArray getPluginCharacteristics() const;
File getPathForModule (const String&) const;
String getPathForModule (const String&) const;
//==============================================================================
File pipFile, outputDirectory, juceModulesPath;