mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Build: Ensure that plugin and manufacturer codes are exactly four characters in length
This commit is contained in:
parent
7525da867b
commit
d13a23ad14
3 changed files with 24 additions and 6 deletions
|
|
@ -446,8 +446,12 @@ function(_juce_version_code version_in out_var)
|
|||
set(${out_var} "${hex}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(_juce_to_char_literal str out_var)
|
||||
string(APPEND str " ") # Make sure there are at least 4 characters in the string.
|
||||
function(_juce_to_char_literal str out_var help_text)
|
||||
string(LENGTH "${str}" string_length)
|
||||
|
||||
if(NOT "${string_length}" EQUAL "4")
|
||||
message(FATAL_ERROR "The ${help_text} code must contain exactly four characters, but it was set to '${str}'")
|
||||
endif()
|
||||
|
||||
# Round-tripping through a file is the simplest way to convert a string to hex...
|
||||
string(SUBSTRING "${str}" 0 4 four_chars)
|
||||
|
|
@ -1137,11 +1141,11 @@ function(_juce_configure_plugin_targets target)
|
|||
get_target_property(use_legacy_compatibility_plugin_code ${target} JUCE_USE_LEGACY_COMPATIBILITY_PLUGIN_CODE)
|
||||
|
||||
if(use_legacy_compatibility_plugin_code)
|
||||
set(project_manufacturer_code "project_manufacturer_code-NOTFOUND")
|
||||
set(project_manufacturer_code "proj")
|
||||
endif()
|
||||
|
||||
_juce_to_char_literal(${project_manufacturer_code} project_manufacturer_code)
|
||||
_juce_to_char_literal(${project_plugin_code} project_plugin_code)
|
||||
_juce_to_char_literal(${project_manufacturer_code} project_manufacturer_code "plugin manufacturer")
|
||||
_juce_to_char_literal(${project_plugin_code} project_plugin_code "plugin")
|
||||
|
||||
_juce_get_vst3_category_string(${target} vst3_category_string)
|
||||
|
||||
|
|
|
|||
|
|
@ -2579,7 +2579,7 @@ StringPairArray Project::getAudioPluginFlags() const
|
|||
|
||||
for (int i = 0; i < 4; ++i)
|
||||
hexRepresentation = (hexRepresentation << 8u)
|
||||
| (static_cast<unsigned int> (fourCharCode[i]) & 0xffu);
|
||||
| (static_cast<unsigned int> (fourCharCode[i]) & 0xffu);
|
||||
|
||||
return "0x" + String::toHexString (static_cast<int> (hexRepresentation));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -292,6 +292,20 @@ Result ProjectSaver::saveProject (ProjectExporter* specifiedExporterToSave)
|
|||
|
||||
if (errors.isEmpty())
|
||||
{
|
||||
if (project.isAudioPluginProject())
|
||||
{
|
||||
const auto isInvalidCode = [] (String code)
|
||||
{
|
||||
return code.length() != 4 || code.toStdString().size() != 4;
|
||||
};
|
||||
|
||||
if (isInvalidCode (project.getPluginManufacturerCodeString()))
|
||||
return Result::fail ("The plugin manufacturer code must contain exactly four characters.");
|
||||
|
||||
if (isInvalidCode (project.getPluginCodeString()))
|
||||
return Result::fail ("The plugin code must contain exactly four characters.");
|
||||
}
|
||||
|
||||
if (project.isAudioPluginProject())
|
||||
{
|
||||
if (project.shouldBuildUnityPlugin())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue