Browse Source

Projucer: Added an optional command-line argument when generating a project from a PIP to specify a JUCE modules directory to be used instead of the global default

tags/2021-05-28
ed 6 years ago
parent
commit
cd8c25b0c1
3 changed files with 18 additions and 7 deletions
  1. +12
    -2
      extras/Projucer/Source/Application/jucer_CommandLine.cpp
  2. +4
    -3
      extras/Projucer/Source/Utility/PIPs/jucer_PIPGenerator.cpp
  3. +2
    -2
      extras/Projucer/Source/Utility/PIPs/jucer_PIPGenerator.h

+ 12
- 2
extras/Projucer/Source/Application/jucer_CommandLine.cpp View File

@@ -718,7 +718,17 @@ namespace
std::cout << "Creating directory " << outputDir.getFullPathName() << std::endl;
}
PIPGenerator generator (pipFile, outputDir);
File juceDir;
if (args.size() > 3)
{
juceDir = args[3].resolveAsFile();
if (! juceDir.exists())
ConsoleApplication::fail ("Specified JUCE modules directory doesn't exist.");
}
PIPGenerator generator (pipFile, outputDir, juceDir);
auto createJucerFileResult = generator.createJucerFile();
@@ -797,7 +807,7 @@ namespace
<< " Sets the global path for a specified os and identifier. The os should be either osx, windows or linux and the identifiers can be any of the following: "
<< "defaultJuceModulePath, defaultUserModulePath, vst3Path, aaxPath (not valid on linux), rtasPath (not valid on linux), androidSDKPath or androidNDKPath." << std::endl
<< std::endl
<< " " << appName << " --create-project-from-pip path/to/PIP path/to/output" << std::endl
<< " " << appName << " --create-project-from-pip path/to/PIP path/to/output path/to/JUCE/modules (optional)" << std::endl
<< " Generates a JUCE project from a PIP file." << std::endl
<< std::endl
<< "Note that for any of the file-rewriting commands, add the option \"--lf\" if you want it to use LF linefeeds instead of CRLF" << std::endl


+ 4
- 3
extras/Projucer/Source/Utility/PIPs/jucer_PIPGenerator.cpp View File

@@ -97,8 +97,9 @@ static bool isMobileExporter (const String& exporterName)
}
//==============================================================================
PIPGenerator::PIPGenerator (const File& pip, const File& output)
PIPGenerator::PIPGenerator (const File& pip, const File& output, const File& juceDir)
: pipFile (pip),
juceDirectory (juceDir),
metadata (parsePIPMetadata())
{
if (output != File())
@@ -290,7 +291,7 @@ ValueTree PIPGenerator::createModulePathChild (const String& moduleID)
ValueTree modulePath (Ids::MODULEPATH);
modulePath.setProperty (Ids::ID, moduleID, nullptr);
modulePath.setProperty (Ids::path, {}, nullptr);
modulePath.setProperty (Ids::path, juceDirectory.getFullPathName(), nullptr);
return modulePath;
}
@@ -367,7 +368,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, 1, nullptr);
module.setProperty (Ids::useGlobalPath, (juceDirectory == File() ? 1 : 0), nullptr);
return module;
}


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

@@ -32,7 +32,7 @@
class PIPGenerator
{
public:
PIPGenerator (const File& pipFile, const File& outputDirectory = {});
PIPGenerator (const File& pipFile, const File& outputDirectory = {}, const File& juceDirectory = {});
//==============================================================================
bool hasValidPIP() const noexcept { return ! metadata[Ids::name].toString().isEmpty(); }
@@ -78,7 +78,7 @@ private:
StringArray getPluginCharacteristics() const;
//==============================================================================
File pipFile, outputDirectory;
File pipFile, outputDirectory, juceDirectory;
var metadata;
bool isTemp = false;


Loading…
Cancel
Save