Browse Source

LV2 Client: Add basic LV2URI validation at build time

v7.0.9
reuk 1 year ago
parent
commit
583f90bef3
2 changed files with 19 additions and 0 deletions
  1. +18
    -0
      modules/juce_audio_plugin_client/juce_audio_plugin_client_LV2.cpp
  2. +1
    -0
      modules/juce_core/system/juce_StandardHeader.h

+ 18
- 0
modules/juce_audio_plugin_client/juce_audio_plugin_client_LV2.cpp View File

@@ -61,6 +61,24 @@ namespace juce
namespace lv2_client
{
constexpr bool startsWithValidScheme (const std::string_view str)
{
constexpr const char* prefixes[] { "http://", "https://", "urn:" };
for (const std::string_view prefix : prefixes)
if (prefix == str.substr (0, prefix.size()))
return true;
return false;
}
// If your LV2 plugin fails to build here, it may be because you haven't explicitly set an LV2 URI,
// or you've requested a malformed URI.
// If you're using the Projucer, update the value of the "LV2 URI" field in your project settings.
// If you're using CMake, specify a valid LV2URI argument to juce_add_plugin.
static_assert (startsWithValidScheme (JucePlugin_LV2URI),
"Your configured LV2 URI must include a leading scheme specifier.");
constexpr auto uriSeparator = ":";
const auto JucePluginLV2UriUi = String (JucePlugin_LV2URI) + uriSeparator + "UI";
const auto JucePluginLV2UriState = String (JucePlugin_LV2URI) + uriSeparator + "StateString";


+ 1
- 0
modules/juce_core/system/juce_StandardHeader.h View File

@@ -67,6 +67,7 @@
#include <queue>
#include <set>
#include <sstream>
#include <string_view>
#include <thread>
#include <typeindex>
#include <unordered_map>


Loading…
Cancel
Save