From a0098034ed2111a42b55c0a7ed44fceb0d2d6971 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Thu, 24 Dec 2020 12:38:47 +0100 Subject: [PATCH] [yabridgectl] Rename the Vst3Module functions Creating a clear naming scheme here is more difficult than it should be. --- tools/yabridgectl/src/actions.rs | 31 +++++++++++++++---------------- tools/yabridgectl/src/files.rs | 12 ++++++------ 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/tools/yabridgectl/src/actions.rs b/tools/yabridgectl/src/actions.rs index 7aa565d7..ea28663f 100644 --- a/tools/yabridgectl/src/actions.rs +++ b/tools/yabridgectl/src/actions.rs @@ -238,7 +238,7 @@ 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 already_installed_architectures = yabridge_vst3_bundles - .entry(module.yabridge_bundle_home()) + .entry(module.target_bundle_home()) .or_insert_with(|| BTreeSet::new()); if !already_installed_architectures.insert(module.architecture()) { eprintln!( @@ -248,7 +248,7 @@ pub fn do_sync(config: &mut Config, options: &SyncOptions) -> Result<()> { prefix, skipping '{}'\n", "WARNING".red(), module.architecture(), - module.yabridge_bundle_home().display(), + module.target_bundle_home().display(), module.original_module_path().display(), )) ); @@ -256,14 +256,23 @@ pub fn do_sync(config: &mut Config, options: &SyncOptions) -> Result<()> { continue; } - let native_module_path = module.yabridge_native_module_path(); - - // For VST3 plugins we'll first have to create the bundle structure + // We're building a merged VST3 bundle containing both a copy or symlink to + // `libyabridge-vst3.so` and the Windows VST3 plugin + let native_module_path = module.target_native_module_path(); utils::create_dir_all(native_module_path.parent().unwrap())?; + if install_file( + options.force, + config.method, + files.libyabridge_vst3.as_ref().unwrap(), + Some(libyabridge_vst3_hash), + &native_module_path, + )? { + num_new += 1; + } // We'll then symlink the Windows VST3 module to that bundle to create a merged // bundle: https://steinbergmedia.github.io/vst3_doc/vstinterfaces/vst3loc.html#mergedbundles - let windows_module_path = module.yabridge_windows_module_path(); + let windows_module_path = module.target_windows_module_path(); utils::create_dir_all(windows_module_path.parent().unwrap())?; install_file( true, @@ -275,16 +284,6 @@ pub fn do_sync(config: &mut Config, options: &SyncOptions) -> Result<()> { // TODO: Symlink resources and presets - if install_file( - options.force, - config.method, - files.libyabridge_vst3.as_ref().unwrap(), - Some(libyabridge_vst3_hash), - &native_module_path, - )? { - num_new += 1; - } - if options.verbose { println!(" {}", module.original_path().display()); } diff --git a/tools/yabridgectl/src/files.rs b/tools/yabridgectl/src/files.rs index 1c82331b..1e7fe1d5 100644 --- a/tools/yabridgectl/src/files.rs +++ b/tools/yabridgectl/src/files.rs @@ -142,13 +142,13 @@ impl Vst3Module { /// /// FIXME: How do we solve naming clashes from the same VST3 plugin being installed to multiple /// Wine prefixes? - pub fn yabridge_bundle_home(&self) -> PathBuf { + pub fn target_bundle_home(&self) -> PathBuf { yabridge_vst3_home().join(self.original_module_name()) } /// Get the path to the `libyabridge.so` file in `~/.vst3` corresponding to the bridged version /// of this module. - pub fn yabridge_native_module_path(&self) -> PathBuf { + pub fn target_native_module_path(&self) -> PathBuf { let native_module_name = match &self { Vst3Module::Legacy(path, _) | Vst3Module::Bundle(path, _) => path .with_extension("so") @@ -159,7 +159,7 @@ impl Vst3Module { .to_owned(), }; - let mut path = self.yabridge_bundle_home(); + let mut path = self.target_bundle_home(); path.push("Contents"); path.push("x86_64-linux"); path.push(native_module_name); @@ -168,8 +168,8 @@ impl Vst3Module { /// Get the path to where we'll symlink `original_module_path`. This is part of the merged VST3 /// bundle in `~/.vst3/yabridge`. - pub fn yabridge_windows_module_path(&self) -> PathBuf { - let mut path = self.yabridge_bundle_home(); + pub fn target_windows_module_path(&self) -> PathBuf { + let mut path = self.target_bundle_home(); path.push("Contents"); path.push(self.architecture().vst_arch()); path.push(self.original_module_name()); @@ -230,7 +230,7 @@ impl SearchResults { // And for VST3 modules. We have not stored the paths to the corresponding `.so` files yet // because they are not in any of the directories we're indexing. installation_status.extend(self.vst3_modules.iter().map(|module| { - let module_path = module.yabridge_native_module_path(); + let module_path = module.target_native_module_path(); let install_type = get_file_type(module_path.clone()); (module_path, install_type) }));