mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-02-05 03:50:07 +00:00
LV2 Host: By default, search in lib64 directories on multilib systems when host is 64-bit
This commit is contained in:
parent
4804e9afd2
commit
5ad617edc0
4 changed files with 50 additions and 8 deletions
|
|
@ -67,7 +67,7 @@
|
|||
#define LILV_DEFAULT_LV2_PATH \
|
||||
"%APPDATA%\\LV2" LILV_PATH_SEP \
|
||||
"%COMMONPROGRAMFILES%\\LV2"
|
||||
#elif JUCE_LINUX || JUCE_ANDROID
|
||||
#elif JUCE_LINUX || JUCE_BSD || JUCE_ANDROID
|
||||
#define LILV_DEFAULT_LV2_PATH \
|
||||
"~/.lv2" LILV_PATH_SEP \
|
||||
"/usr/lib/lv2" LILV_PATH_SEP \
|
||||
|
|
|
|||
|
|
@ -1841,7 +1841,12 @@ class World
|
|||
public:
|
||||
World() : world (lilv_world_new()) {}
|
||||
|
||||
void loadAll() { lilv_world_load_all (world.get()); }
|
||||
void loadAllFromPaths (const NodeString& paths)
|
||||
{
|
||||
lilv_world_set_option (world.get(), LILV_OPTION_LV2_PATH, paths.get());
|
||||
lilv_world_load_all (world.get());
|
||||
}
|
||||
|
||||
void loadBundle (const NodeUri& uri) { lilv_world_load_bundle (world.get(), uri.get()); }
|
||||
void unloadBundle (const NodeUri& uri) { lilv_world_unload_bundle (world.get(), uri.get()); }
|
||||
|
||||
|
|
@ -5189,7 +5194,7 @@ class LV2PluginFormat::Pimpl
|
|||
public:
|
||||
Pimpl()
|
||||
{
|
||||
world->loadAll();
|
||||
loadAllPluginsFromPaths (getDefaultLocationsToSearch());
|
||||
|
||||
const auto tempFile = lv2ResourceFolder.getFile();
|
||||
|
||||
|
|
@ -5252,9 +5257,9 @@ public:
|
|||
return findPluginByUri (description.fileOrIdentifier) != nullptr;
|
||||
}
|
||||
|
||||
StringArray searchPathsForPlugins (const FileSearchPath&, bool, bool)
|
||||
StringArray searchPathsForPlugins (const FileSearchPath& paths, bool, bool)
|
||||
{
|
||||
world->loadAll();
|
||||
loadAllPluginsFromPaths (paths);
|
||||
|
||||
StringArray result;
|
||||
|
||||
|
|
@ -5264,7 +5269,30 @@ public:
|
|||
return result;
|
||||
}
|
||||
|
||||
FileSearchPath getDefaultLocationsToSearch() { return {}; }
|
||||
FileSearchPath getDefaultLocationsToSearch()
|
||||
{
|
||||
#if JUCE_MAC
|
||||
return { "~/Library/Audio/Plug-Ins/LV2;"
|
||||
"~/.lv2;"
|
||||
"/usr/local/lib/lv2;"
|
||||
"/usr/lib/lv2;"
|
||||
"/Library/Audio/Plug-Ins/LV2;" };
|
||||
#elif JUCE_WINDOWS
|
||||
return { "%APPDATA%\\LV2;"
|
||||
"%COMMONPROGRAMFILES%\\LV2" };
|
||||
#else
|
||||
#if JUCE_64BIT
|
||||
if (File ("/usr/lib64/lv2").exists() || File ("/usr/local/lib64/lv2").exists())
|
||||
return { "~/.lv2;"
|
||||
"/usr/lib64/lv2;"
|
||||
"/usr/local/lib64/lv2" };
|
||||
#endif
|
||||
|
||||
return { "~/.lv2;"
|
||||
"/usr/lib/lv2;"
|
||||
"/usr/local/lib/lv2" };
|
||||
#endif
|
||||
}
|
||||
|
||||
const LilvUI* findEmbeddableUi (const lv2_host::Uis* pluginUis, std::true_type)
|
||||
{
|
||||
|
|
@ -5457,6 +5485,12 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
void loadAllPluginsFromPaths (const FileSearchPath& path)
|
||||
{
|
||||
const auto joined = path.toStringWithSeparator (LILV_PATH_SEP);
|
||||
world->loadAllFromPaths (world->newString (joined.toRawUTF8()));
|
||||
}
|
||||
|
||||
struct Free { void operator() (char* ptr) const noexcept { free (ptr); } };
|
||||
using StringPtr = std::unique_ptr<char, Free>;
|
||||
|
||||
|
|
|
|||
|
|
@ -67,14 +67,19 @@ File FileSearchPath::operator[] (int index) const
|
|||
}
|
||||
|
||||
String FileSearchPath::toString() const
|
||||
{
|
||||
return toStringWithSeparator (";");
|
||||
}
|
||||
|
||||
String FileSearchPath::toStringWithSeparator (StringRef separator) const
|
||||
{
|
||||
auto dirs = directories;
|
||||
|
||||
for (auto& d : dirs)
|
||||
if (d.containsChar (';'))
|
||||
if (d.contains (separator))
|
||||
d = d.quoted();
|
||||
|
||||
return dirs.joinIntoString (";");
|
||||
return dirs.joinIntoString (separator);
|
||||
}
|
||||
|
||||
void FileSearchPath::add (const File& dir, int insertIndex)
|
||||
|
|
|
|||
|
|
@ -78,6 +78,9 @@ public:
|
|||
/** Returns the search path as a semicolon-separated list of directories. */
|
||||
String toString() const;
|
||||
|
||||
/** Returns the search paths, joined with the provided separator. */
|
||||
String toStringWithSeparator (StringRef separator) const;
|
||||
|
||||
//==============================================================================
|
||||
/** Adds a new directory to the search path.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue