diff --git a/extras/Projucer/Source/Utility/PIPs/jucer_PIPGenerator.cpp b/extras/Projucer/Source/Utility/PIPs/jucer_PIPGenerator.cpp index f9a5b912c8..16cca90e3e 100644 --- a/extras/Projucer/Source/Utility/PIPs/jucer_PIPGenerator.cpp +++ b/extras/Projucer/Source/Utility/PIPs/jucer_PIPGenerator.cpp @@ -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 {}; +} diff --git a/extras/Projucer/Source/Utility/PIPs/jucer_PIPGenerator.h b/extras/Projucer/Source/Utility/PIPs/jucer_PIPGenerator.h index 67f16d0a83..f28337e2c0 100644 --- a/extras/Projucer/Source/Utility/PIPs/jucer_PIPGenerator.h +++ b/extras/Projucer/Source/Utility/PIPs/jucer_PIPGenerator.h @@ -75,6 +75,7 @@ private: StringArray getPluginCharacteristics() const; String getPathForModule (const String&) const; + File getExamplesDirectory() const; //============================================================================== File pipFile, outputDirectory, juceModulesPath;