From 81a16ade0e58a00700f5b333435e11d231efd321 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Thu, 13 Mar 2025 22:38:20 -0400 Subject: [PATCH] Automatically set Core plugin version to Rack app version. --- Core.json | 1 - src/plugin.cpp | 4 ++++ src/plugin/Plugin.cpp | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Core.json b/Core.json index 0a2a6a3f..4726680a 100644 --- a/Core.json +++ b/Core.json @@ -1,7 +1,6 @@ { "slug": "Core", "name": "VCV Core", - "version": "2.6.0", "license": "GPL-3.0-or-later", "author": "VCV", "brand": "VCV", diff --git a/src/plugin.cpp b/src/plugin.cpp index fefa46d8..3be598cb 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -133,7 +133,11 @@ static Plugin* loadPlugin(std::string path) { INFO("Loading plugin from %s", path.c_str()); Plugin* plugin = new Plugin; + try { + if (path == "") + plugin->version = APP_VERSION; + // Set plugin path plugin->path = (path == "") ? asset::systemDir : path; diff --git a/src/plugin/Plugin.cpp b/src/plugin/Plugin.cpp index 2f5a98ea..5480b11d 100644 --- a/src/plugin/Plugin.cpp +++ b/src/plugin/Plugin.cpp @@ -48,10 +48,10 @@ void Plugin::fromJson(json_t* rootJ) { json_t* versionJ = json_object_get(rootJ, "version"); if (versionJ) version = json_string_value(versionJ); - if (!string::startsWith(version, APP_VERSION_MAJOR + ".")) - throw Exception("Plugin version %s does not match Rack ABI version %s", version.c_str(), APP_VERSION_MAJOR.c_str()); if (version == "") throw Exception("No plugin version"); + if (!string::startsWith(version, APP_VERSION_MAJOR + ".")) + throw Exception("Plugin version %s does not match Rack ABI version %s", version.c_str(), APP_VERSION_MAJOR.c_str()); // name json_t* nameJ = json_object_get(rootJ, "name");