Browse Source

Projucer: Check command-line JUCE modules path before the global path when creating PIPs from JUCE examples

tags/2021-05-28
ed 6 years ago
parent
commit
02b7c0936d
2 changed files with 25 additions and 6 deletions
  1. +24
    -6
      extras/Projucer/Source/Utility/PIPs/jucer_PIPGenerator.cpp
  2. +1
    -0
      extras/Projucer/Source/Utility/PIPs/jucer_PIPGenerator.h

+ 24
- 6
extras/Projucer/Source/Utility/PIPs/jucer_PIPGenerator.cpp View File

@@ -254,11 +254,11 @@ ValueTree PIPGenerator::createExporterChild (const String& exporterName)
if (isJUCEExample (pipFile) && exporterRequiresExampleAssets (exporterName, metadata[Ids::name]))
{
auto juceDir = getAppSettings().getStoredPath (Ids::jucePath, TargetOS::getThisOS()).get().toString();
auto examplesDir = getExamplesDirectory();
if (isValidJUCEExamplesDirectory (File (juceDir).getChildFile ("examples")))
if (examplesDir != File())
{
auto assetsDirectoryPath = File (juceDir).getChildFile ("examples").getChildFile ("Assets").getFullPathName();
auto assetsDirectoryPath = examplesDir.getChildFile ("Assets").getFullPathName();
exporter.setProperty (exporterName == "ANDROIDSTUDIO" ? Ids::androidExtraAssetsFolder
: Ids::customXcodeResourceFolders,
@@ -357,12 +357,12 @@ Result PIPGenerator::setProjectSettings (ValueTree& jucerTree)
if (useLocalCopy && isJUCEExample (pipFile))
{
auto juceDir = getAppSettings().getStoredPath (Ids::jucePath, TargetOS::getThisOS()).get().toString();
auto examplesDir = getExamplesDirectory();
if (isValidJUCEExamplesDirectory (File (juceDir).getChildFile ("examples")))
if (examplesDir != File())
{
defines += ((defines.isEmpty() ? "" : " ") + String ("PIP_JUCE_EXAMPLES_DIRECTORY=")
+ Base64::toBase64 (File (juceDir).getChildFile ("examples").getFullPathName()));
+ Base64::toBase64 (examplesDir.getFullPathName()));
}
else
{
@@ -556,3 +556,21 @@ String PIPGenerator::getPathForModule (const String& moduleID) const
return {};
}
File PIPGenerator::getExamplesDirectory() const
{
if (juceModulesPath != File())
{
auto examples = juceModulesPath.getSiblingFile ("examples");
if (isValidJUCEExamplesDirectory (examples))
return examples;
}
auto examples = File (getAppSettings().getStoredPath (Ids::jucePath, TargetOS::getThisOS()).get().toString()).getChildFile ("examples");
if (isValidJUCEExamplesDirectory (examples))
return examples;
return {};
}

+ 1
- 0
extras/Projucer/Source/Utility/PIPs/jucer_PIPGenerator.h View File

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


Loading…
Cancel
Save