[yabridgectl] Clean up VST3 bundles

We would completely remove VST3 bundles that yabridgectl does not know
about anymore, but we would not remove leftover files within bundles.
This could otherwise cause issues when messing with 32-bit and 64-bit
versions of plugins or yabridge itself.
This commit is contained in:
Robbert van der Helm
2021-06-24 16:04:04 +02:00
parent 0b8221b136
commit 5ea04c402e
2 changed files with 17 additions and 4 deletions
+5
View File
@@ -70,6 +70,11 @@ Versioning](https://semver.org/spec/v2.0.0.html).
- Added support for setting up merged VST3 bundles with a 32-bit version of
`libyabridge-vst3.so`.
- Merged VST3 bundles set up in `~/.vst3/yabridge` are now always cleared before
yabridgectl adds new files to them. This makes it easier to switch from the
64-bit version of a plugin to the 32-bit version, or from a 64-bit version of
yabridge to the 32-bit version. I don't know why you would want to do either
of those things, but now you can!
- Copies of `libyabridge-vst2.so` and `libyabridge-vst3.so` are now reflinked
when supported by the file system. This speeds up the file coyping process
while also reducing the amount of disk space used for yabridge when using
+12 -4
View File
@@ -285,9 +285,10 @@ pub fn do_sync(config: &mut Config, options: &SyncOptions) -> Result<()> {
// 32-bit and 64-bit versions of the plugin cna live inside of the same
// bundle), and show a warning if we come across any duplicates.
let target_bundle_home = module.target_bundle_home();
let (updated_libyabridge, already_installed_architectures) =
yabridge_vst3_bundles
.entry(module.target_bundle_home())
.entry(target_bundle_home.clone())
.or_insert_with(|| (false, BTreeSet::new()));
if !already_installed_architectures.insert(module.architecture) {
eprintln!(
@@ -305,13 +306,20 @@ pub fn do_sync(config: &mut Config, options: &SyncOptions) -> Result<()> {
continue;
}
// NOTE: We need to make sure the VST3 bundle is completely empty before setting
// it up. Otherwise you would it would contain orphan plugin files after
// uninstalling the 32-bit version of a VST3 plugin while the 64-bit
// version is still installed, or when switching between the 32-bit and
// the 64-bit versions of yabridge
if !*updated_libyabridge && target_bundle_home.exists() {
utils::remove_dir_all(target_bundle_home)
.context("Could not clean up old VST3 bundle")?;
}
// We're building a merged VST3 bundle containing both a copy or symlink to
// `libyabridge-vst3.so` and the Windows VST3 plugin. The path to this native
// module will depend on whether `libyabridge-vst3.so` is a 32-bit or a 64-bit
// library file.
// TODO: Make sure the bundle is cleared before setting this up for the first
// time, or else it won't be possible to cleanly switch between 32-bit and
// 64-bit yabridge.
let native_module_path = module.target_native_module_path(Some(&files));
utils::create_dir_all(native_module_path.parent().unwrap())?;
if install_file(