From cbc417d99d63e35a97ef4efccdba306424521dd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Micha=C3=ABl=20Celerier?= Date: Mon, 8 Jul 2024 11:40:52 -0400 Subject: [PATCH] [vst/vst3] Support VST_PATH & VST3_PATH env var --- src/plugins/score-plugin-vst/Vst/ApplicationPlugin.cpp | 8 +++++++- src/plugins/score-plugin-vst/Vst/ApplicationPlugin.hpp | 2 +- src/plugins/score-plugin-vst3/Vst3/ApplicationPlugin.cpp | 7 +++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/plugins/score-plugin-vst/Vst/ApplicationPlugin.cpp b/src/plugins/score-plugin-vst/Vst/ApplicationPlugin.cpp index 5af239b3c9..cf2826072f 100644 --- a/src/plugins/score-plugin-vst/Vst/ApplicationPlugin.cpp +++ b/src/plugins/score-plugin-vst/Vst/ApplicationPlugin.cpp @@ -160,9 +160,15 @@ void ApplicationPlugin::unregisterRunningVST(Model* m) } } -void ApplicationPlugin::rescanVSTs(const QStringList& paths) +void ApplicationPlugin::rescanVSTs(QStringList paths) { #if QT_CONFIG(process) + // 0. Handle VST_PATH + if(QFileInfo vst_env_path{QString(qgetenv("VST_PATH"))}; vst_env_path.isDir()) + { + paths += vst_env_path.canonicalPath(); + } + // 1. List all plug-ins in new paths QStringList exploredPaths; QSet newPlugins; diff --git a/src/plugins/score-plugin-vst/Vst/ApplicationPlugin.hpp b/src/plugins/score-plugin-vst/Vst/ApplicationPlugin.hpp index 56b0920d89..e82bd57f4e 100644 --- a/src/plugins/score-plugin-vst/Vst/ApplicationPlugin.hpp +++ b/src/plugins/score-plugin-vst/Vst/ApplicationPlugin.hpp @@ -38,7 +38,7 @@ class ApplicationPlugin void initialize() override; ~ApplicationPlugin() override; - void rescanVSTs(const QStringList&); + void rescanVSTs(QStringList); void processIncomingMessage(const QString& txt); void addInvalidVST(const QString& path); void addVST(const QString& path, const QJsonObject& json); diff --git a/src/plugins/score-plugin-vst3/Vst3/ApplicationPlugin.cpp b/src/plugins/score-plugin-vst3/Vst3/ApplicationPlugin.cpp index d54908d79b..bfec41e053 100644 --- a/src/plugins/score-plugin-vst3/Vst3/ApplicationPlugin.cpp +++ b/src/plugins/score-plugin-vst3/Vst3/ApplicationPlugin.cpp @@ -141,6 +141,7 @@ void ApplicationPlugin::rescan() { auto paths = default_paths; + // User folders #if defined(__APPLE__) const QString user = qgetenv("USERNAME"); paths.prepend(QString("/Users/%1/Library/Audio/Plug-ins/VST3/").arg(user)); @@ -151,6 +152,12 @@ void ApplicationPlugin::rescan() const QString home = qgetenv("HOME"); paths.prepend(QString("%1/.vst3/").arg(home)); #endif + + // VST3_PATH + if(QFileInfo vst_env_path{QString(qgetenv("VST3_PATH"))}; vst_env_path.isDir()) + { + paths += vst_env_path.canonicalPath(); + } rescan(paths); }