Skip to content

Commit b9627e7

Browse files
committed
Set LD_LIBRARY_PATH for shared libraries on Linux before loading plugins via Plugin Installer
1 parent eab861a commit b9627e7

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

Source/UI/PluginInstaller.cpp

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,9 +1180,11 @@ void PluginInfoComponent::run()
11801180
{
11811181
LOGC ("Download Successful!");
11821182

1183+
String pluginVer = pInfo.selectedVersion.substring (0, pInfo.selectedVersion.indexOf ("-API"));
1184+
11831185
showAlertOnMessageThread (AlertWindow::InfoIcon,
11841186
"[Plugin Installer] " + pInfo.displayName,
1185-
pInfo.displayName + " Installed Successfully");
1187+
pInfo.displayName + " v" + pluginVer + " Installed Successfully!");
11861188

11871189
updateUIOnMessageThread();
11881190
}
@@ -1654,7 +1656,7 @@ int PluginInfoComponent::downloadPlugin (const String& plugin, const String& ver
16541656
// Copy only if shared files exist
16551657
if (fs::exists (tempSharedPath))
16561658
{
1657-
#ifdef JUCE_WINDOWS || JUCE_MAC
1659+
#if JUCE_WINDOWS || JUCE_MAC
16581660
const auto copyOptions = fs::copy_options::overwrite_existing
16591661
| fs::copy_options::recursive
16601662
| fs::copy_options::copy_symlinks;
@@ -1686,6 +1688,23 @@ int PluginInfoComponent::downloadPlugin (const String& plugin, const String& ver
16861688
return 5;
16871689
}
16881690

1691+
#if JUCE_LINUX
1692+
// Add shared library directory to LD_LIBRARY_PATH before loading plugin
1693+
setStatusMessage ("Setting up library path...");
1694+
1695+
File sharedDir = getSharedDirectory();
1696+
String currentPath = SystemStats::getEnvironmentVariable ("LD_LIBRARY_PATH", "");
1697+
String newPath = sharedDir.getFullPathName();
1698+
1699+
if (! currentPath.contains (newPath))
1700+
{
1701+
if (! currentPath.isEmpty())
1702+
newPath += ":" + currentPath;
1703+
1704+
setenv ("LD_LIBRARY_PATH", newPath.toRawUTF8(), 1);
1705+
}
1706+
#endif
1707+
16891708
LOGD ("Loading plugin: ", pInfo.displayName, "from ", pluginDllPath);
16901709

16911710
int retCode = -1;

0 commit comments

Comments
 (0)