mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 20:10:13 +02:00
Allow yet another symlinking method, fixing #3
This allows symlinking to a copy of `libyabridge.so.` Now we support: - A symlink to `libyabridge.so` with a `.dll` file in the same directory as that symlink. - A symlink to `libyabridge.so` with a symlinked `.dll`. - A copy of `libyabridge.so` with a `.dll` file in the same directory as that copy. - A symlink to a copy of `libyabridge.so` with a `.dll` file in the same directory as that copy. - A symlink to a copy of `libyabridge.so` with a symlinked `.dll` file. That seems a bit overkill, but hey, more options are always better, right?
This commit is contained in:
@@ -6,6 +6,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic
|
||||
Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Changed
|
||||
|
||||
- Changed the plugin detection mechanism to support yet another way of
|
||||
symlinking plugins. Now you can use a symlink to a copy of `libyabridge.so`
|
||||
that's installed for a plugin in another directory. This is not recommended
|
||||
though. Fixes #3.
|
||||
|
||||
## [1.0.0] - 2020-05-03
|
||||
|
||||
### Added
|
||||
|
||||
+24
-11
@@ -85,7 +85,10 @@ fs::path find_vst_host(PluginArchitecture plugin_arch);
|
||||
/**
|
||||
* Find the VST plugin .dll file that corresponds to this copy of
|
||||
* `libyabridge.so`. This should be the same as the name of this file but with a
|
||||
* `.dll` file extension instead of `.so`.
|
||||
* `.dll` file extension instead of `.so`. In case this file does not exist and
|
||||
* the `.so` file is a symlink, we'll also repeat this check for the file it
|
||||
* links to. This is to support the workflow described in issue #3 where you use
|
||||
* symlinks to copies of `libyabridge.so`.
|
||||
*
|
||||
* @return The a path to the accompanying VST plugin .dll file.
|
||||
* @throw std::runtime_error If no matching .dll file could be found.
|
||||
@@ -639,20 +642,30 @@ fs::path find_vst_host(PluginArchitecture plugin_arch) {
|
||||
}
|
||||
|
||||
fs::path find_vst_plugin() {
|
||||
fs::path plugin_path = boost::dll::this_line_location();
|
||||
const fs::path this_plugin_path = boost::dll::this_line_location();
|
||||
|
||||
fs::path plugin_path(this_plugin_path);
|
||||
plugin_path.replace_extension(".dll");
|
||||
if (fs::exists(plugin_path)) {
|
||||
// Also resolve symlinks here, to support symlinked .dll files
|
||||
return fs::canonical(plugin_path);
|
||||
}
|
||||
|
||||
// In case this files does not exist and our `.so` file is a symlink, we'll
|
||||
// also repeat this check after resolving that symlink to support links to
|
||||
// copies of `libyabridge.so` as described in issue #3
|
||||
fs::path alternative_plugin_path = fs::canonical(this_plugin_path);
|
||||
alternative_plugin_path.replace_extension(".dll");
|
||||
if (fs::exists(alternative_plugin_path)) {
|
||||
return fs::canonical(alternative_plugin_path);
|
||||
}
|
||||
|
||||
// This function is used in the constructor's initializer list so we have to
|
||||
// throw when the path could not be found
|
||||
if (!fs::exists(plugin_path)) {
|
||||
throw std::runtime_error(
|
||||
"'" + plugin_path.string() +
|
||||
"' does not exist, make sure to rename 'libyabridge.so' to match a "
|
||||
"VST plugin .dll file.");
|
||||
}
|
||||
|
||||
// Also resolve symlinks here
|
||||
return fs::canonical(plugin_path);
|
||||
throw std::runtime_error("'" + plugin_path.string() +
|
||||
"' does not exist, make sure to rename "
|
||||
"'libyabridge.so' to match a "
|
||||
"VST plugin .dll file.");
|
||||
}
|
||||
|
||||
PluginArchitecture find_plugin_architecture(fs::path plugin_path) {
|
||||
|
||||
Reference in New Issue
Block a user