Skip to content

Commit

Permalink
[vst/vst3] Support VST_PATH & VST3_PATH env var
Browse files Browse the repository at this point in the history
  • Loading branch information
jcelerier committed Jul 8, 2024
1 parent 2b7da24 commit cbc417d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/plugins/score-plugin-vst/Vst/ApplicationPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<QString> newPlugins;
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/score-plugin-vst/Vst/ApplicationPlugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 7 additions & 0 deletions src/plugins/score-plugin-vst3/Vst3/ApplicationPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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);
}

Expand Down

0 comments on commit cbc417d

Please sign in to comment.