| @@ -451,7 +451,7 @@ 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}'") | |||
| message(WARNING "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... | |||
| @@ -463,7 +463,8 @@ function(_juce_to_char_literal str out_var help_text) | |||
| file(READ "${scratch_file}" four_chars_hex HEX) | |||
| file(REMOVE "${scratch_file}") | |||
| set(${out_var} ${four_chars_hex} PARENT_SCOPE) | |||
| string(SUBSTRING "${four_chars_hex}00000000" 0 8 four_chars_hex) | |||
| set(${out_var} "${four_chars_hex}" PARENT_SCOPE) | |||
| endfunction() | |||
| # ================================================================================================== | |||
| @@ -826,6 +826,14 @@ void Project::updateJUCEPathWarning() | |||
| } | |||
| } | |||
| void Project::updateCodeWarning (Identifier identifier, String value) | |||
| { | |||
| if (value.length() != 4 || value.toStdString().size() != 4) | |||
| addProjectMessage (identifier, {}); | |||
| else | |||
| removeProjectMessage (identifier); | |||
| } | |||
| void Project::updateModuleWarnings() | |||
| { | |||
| auto& modules = getEnabledModules(); | |||
| @@ -1091,6 +1099,14 @@ void Project::valueTreePropertyChanged (ValueTree& tree, const Identifier& prope | |||
| { | |||
| updateModuleWarnings(); | |||
| } | |||
| else if (property == Ids::pluginCode) | |||
| { | |||
| updateCodeWarning (ProjectMessages::Ids::pluginCodeInvalid, pluginCodeValue.get()); | |||
| } | |||
| else if (property == Ids::pluginManufacturerCode) | |||
| { | |||
| updateCodeWarning (ProjectMessages::Ids::manufacturerCodeInvalid, pluginManufacturerCodeValue.get()); | |||
| } | |||
| } | |||
| changed(); | |||
| @@ -2578,8 +2594,10 @@ StringPairArray Project::getAudioPluginFlags() const | |||
| uint32 hexRepresentation = 0; | |||
| for (int i = 0; i < 4; ++i) | |||
| hexRepresentation = (hexRepresentation << 8u) | |||
| | (static_cast<unsigned int> (fourCharCode[i]) & 0xffu); | |||
| { | |||
| const auto character = (unsigned int) (i < fourCharCode.length() ? fourCharCode[i] : 0); | |||
| hexRepresentation = (hexRepresentation << 8u) | (character & 0xffu); | |||
| } | |||
| return "0x" + String::toHexString (static_cast<int> (hexRepresentation)); | |||
| }; | |||
| @@ -50,6 +50,8 @@ namespace ProjectMessages | |||
| DECLARE_ID (oldProjucer); | |||
| DECLARE_ID (cLion); | |||
| DECLARE_ID (newVersionAvailable); | |||
| DECLARE_ID (pluginCodeInvalid); | |||
| DECLARE_ID (manufacturerCodeInvalid); | |||
| DECLARE_ID (notification); | |||
| DECLARE_ID (warning); | |||
| @@ -63,7 +65,7 @@ namespace ProjectMessages | |||
| { | |||
| static Identifier warnings[] = { Ids::incompatibleLicense, Ids::cppStandard, Ids::moduleNotFound, | |||
| Ids::jucePath, Ids::jucerFileModified, Ids::missingModuleDependencies, | |||
| Ids::oldProjucer, Ids::cLion }; | |||
| Ids::oldProjucer, Ids::cLion, Ids::pluginCodeInvalid, Ids::manufacturerCodeInvalid }; | |||
| if (std::find (std::begin (warnings), std::end (warnings), message) != std::end (warnings)) | |||
| return Ids::warning; | |||
| @@ -86,6 +88,8 @@ namespace ProjectMessages | |||
| if (message == Ids::oldProjucer) return "Projucer Out of Date"; | |||
| if (message == Ids::newVersionAvailable) return "New Version Available"; | |||
| if (message == Ids::cLion) return "Deprecated Exporter"; | |||
| if (message == Ids::pluginCodeInvalid) return "Invalid Plugin Code"; | |||
| if (message == Ids::manufacturerCodeInvalid) return "Invalid Manufacturer Code"; | |||
| jassertfalse; | |||
| return {}; | |||
| @@ -102,6 +106,8 @@ namespace ProjectMessages | |||
| if (message == Ids::oldProjucer) return "The version of the Projucer you are using is out of date."; | |||
| if (message == Ids::newVersionAvailable) return "A new version of JUCE is available to download."; | |||
| if (message == Ids::cLion) return "The CLion exporter is deprecated. Use JUCE's CMake support instead."; | |||
| if (message == Ids::pluginCodeInvalid) return "The plugin code should be exactly four characters in length."; | |||
| if (message == Ids::manufacturerCodeInvalid) return "The manufacturer code should be exactly four characters in length."; | |||
| jassertfalse; | |||
| return {}; | |||
| @@ -618,6 +624,7 @@ private: | |||
| void updateOldProjucerWarning (bool showWarning); | |||
| void updateCLionWarning (bool showWarning); | |||
| void updateModuleNotFoundWarning (bool showWarning); | |||
| void updateCodeWarning (Identifier identifier, String value); | |||
| ValueTree projectMessages { ProjectMessages::Ids::projectMessages, {}, | |||
| { { ProjectMessages::Ids::notification, {} }, { ProjectMessages::Ids::warning, {} } } }; | |||
| @@ -291,20 +291,6 @@ 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()) | |||