[yabridgectl] Fix subdirectory detect for bundles

This commit is contained in:
Robbert van der Helm
2022-06-11 14:49:16 +02:00
parent 84ab5a4cd5
commit ae73df2b17
2 changed files with 32 additions and 3 deletions
+6
View File
@@ -12,6 +12,12 @@ Versioning](https://semver.org/spec/v2.0.0.html).
- Added a `system-asio` build option to aid distro packaging.
### yabridgectl
- Fixed a regression from yabridge 4.0.0 where VST3 plugins in the 'new' bundle
format, like _Sforzando_, were not set up correctly due to the subdirectory
detection logic change from the previous release.
### Packaging notes
- The new `system-asio` build option forces asio to be used from the standard
+26 -3
View File
@@ -430,6 +430,9 @@ impl SearchResults {
/// to actual VST2 plugins and VST3 modules using `search()`. Any path found in the blacklist will
/// be pruned immediately, so this can be used to both not index individual files and to skip an
/// entire directory.
///
/// For VST3 plugin _bundles_ the subdirectory also contains the `foo.vst3/Contents/x86_64-win`
/// suffix. This needs to be stripped out to get the bundle root.
pub fn index(directory: &Path, blacklist: &HashSet<&Path>) -> SearchIndex {
// These are pairs of `(absolute_path, subdirectory)`. The subdirectory is used for setting up
// VST3 plugins and for setting up VST2 plugins in the centralized installation location mode.
@@ -483,6 +486,8 @@ pub fn index(directory: &Path, blacklist: &HashSet<&Path>) -> SearchIndex {
dll_files.push((path, subdirectory));
}
Some("vst3") => {
// NOTE: For bundles this will also contain the `foo.vst3/Contents/x86_64-win`
// suffix. This needs to be stripped later.
let subdirectory = path
.parent()
.and_then(|p| p.strip_prefix(directory).ok())
@@ -588,10 +593,28 @@ impl SearchIndex {
})
.unwrap_or(false);
let module = if module_is_in_bundle {
Vst3ModuleType::Bundle(bundle_root.unwrap().to_owned())
let (module, subdirectory) = if module_is_in_bundle {
(
Vst3ModuleType::Bundle(bundle_root.unwrap().to_owned()),
// The subdirectory should be relative to the bundle, not to the .vst3
// file inside of the bundle. The latter is what we get from the index
// function since it only considers regular files and symlinks.
subdirectory.map(|subdirectory| {
subdirectory
// x86_64-win
.parent()
.unwrap()
// Contents
.parent()
.unwrap()
// foo.vst3
.parent()
.unwrap()
.to_owned()
}),
)
} else {
Vst3ModuleType::Legacy(module_path)
(Vst3ModuleType::Legacy(module_path), subdirectory)
};
Ok(Ok(Vst3Module {