1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-22 01:34:21 +00:00

Projucer: Made it possible to specify a semicolon-separated list of user modules paths to override the global default when generating a project from a PIP using the "--create-project-from-pip" command-line option

This commit is contained in:
ed 2018-09-06 16:49:35 +01:00
parent a3f20c0d08
commit 9761a03334
3 changed files with 70 additions and 25 deletions

View file

@ -659,6 +659,13 @@ namespace
|| id == "androidSDKPath" || id == "androidNDKPath" || id == "defaultJuceModulePath" || id == "defaultUserModulePath";
}
static void checkIfUserModulesPathsAreValid (const String& list)
{
for (auto& p : StringArray::fromTokens (list, ";", {}))
if (! File (p.trim()).exists())
ConsoleApplication::fail (p + " doesn't exist!");
}
static void setGlobalPath (const ArgumentList& args)
{
args.checkMinNumArguments (3);
@ -697,9 +704,16 @@ namespace
ConsoleApplication::fail ("Failed to set the requested setting!");
if (args[2].text == Ids::defaultUserModulePath.toString())
childToSet.setProperty (args[2].text, args[3].text.removeCharacters ("\""), nullptr);
{
auto pathList = args[3].text.removeCharacters ("\"");
checkIfUserModulesPathsAreValid (pathList);
childToSet.setProperty (args[2].text, pathList, nullptr);
}
else
{
childToSet.setProperty (args[2].text, args[3].resolveAsFile().getFullPathName(), nullptr);
}
settingsFile.replaceWithText (settingsTree.toXmlString());
}
@ -721,17 +735,27 @@ namespace
std::cout << "Creating directory " << outputDir.getFullPathName() << std::endl;
}
File juceDir;
File juceModulesPath;
Array<File> userModulesPaths;
if (args.size() > 3)
{
juceDir = args[3].resolveAsFile();
juceModulesPath = args[3].resolveAsFile();
if (! juceDir.exists())
if (! juceModulesPath.exists())
ConsoleApplication::fail ("Specified JUCE modules directory doesn't exist.");
if (args.size() == 5)
{
auto pathList = args[4].text.removeCharacters ("\"");
checkIfUserModulesPathsAreValid (pathList);
for (auto& p : StringArray::fromTokens (pathList, ";", {}))
userModulesPaths.add ({ p });
}
}
PIPGenerator generator (pipFile, outputDir, juceDir);
PIPGenerator generator (pipFile, outputDir, juceModulesPath, userModulesPaths);
auto createJucerFileResult = generator.createJucerFile();
@ -811,8 +835,9 @@ namespace
<< "defaultJuceModulePath, defaultUserModulePath, vst3Path, aaxPath (not valid on linux), rtasPath (not valid on linux), androidSDKPath or androidNDKPath. "
"When setting defaultUserModulePath you can specify multiple paths by surrounding a semicolon-separated list of paths with double quotes \"like;so\"" << std::endl
<< 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
<< " " << appName << " --create-project-from-pip path/to/PIP path/to/output path/to/JUCE/modules (optional) path/to/user/modules (optional)" << std::endl
<< " Generates a folder containing a JUCE project in the specified output path using the specified PIP file. Use the optional JUCE and user module paths to override "
"the global module paths (you can specify multiple user module paths by using a semicolon-separated list)." << 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
<< std::endl;