1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

VST3 Host: Use correct path to .so on Linux

This fixes an issue where VST3 plugins failed to scan and load on Linux.
This commit is contained in:
reuk 2024-10-10 13:18:09 +01:00
parent 362a1cc070
commit ca8b5f7483

View file

@ -1334,8 +1334,10 @@ public:
return handle.getFile();
}
static Ptr getHandle (const File& f)
static Ptr getHandle (const String& modulePath)
{
const auto f = getDLLFileFromBundle (modulePath);
auto& bundles = getHandles();
const auto iter = std::find_if (bundles.begin(), bundles.end(), [&] (Ptr x)
@ -1356,6 +1358,30 @@ private:
getHandles().insert (this);
}
static File getDLLFileFromBundle (const String& bundlePath)
{
#if JUCE_LINUX || JUCE_BSD
const auto machineName = []() -> String
{
struct utsname unameData;
const auto res = uname (&unameData);
if (res != 0)
return {};
return unameData.machine;
}();
const File file { bundlePath };
return file.getChildFile ("Contents")
.getChildFile (machineName + "-linux")
.getChildFile (file.getFileNameWithoutExtension() + ".so");
#else
return File { bundlePath };
#endif
}
static std::set<RefCountedDllHandle*>& getHandles()
{
static std::set<RefCountedDllHandle*> bundles;
@ -1373,7 +1399,7 @@ public:
static VST3ModuleHandle create (const File& pluginFile, const PluginDescription& desc)
{
VST3ModuleHandle result;
result.handle = RefCountedDllHandle::getHandle (pluginFile);
result.handle = RefCountedDllHandle::getHandle (pluginFile.getFullPathName());
if (result.handle == nullptr)
return {};