From d79ccc75e6edef98cf923ac876c9a264783cf2c1 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Thu, 24 Dec 2020 12:45:14 +0100 Subject: [PATCH] [yabridgectl] Symlink VST 3.6.10 bundle resources Although I haven't run into any of these 'new' bundles yet. Everything's still in the legacy format. --- tools/yabridgectl/src/actions.rs | 14 +++++++++++++- tools/yabridgectl/src/files.rs | 27 +++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/tools/yabridgectl/src/actions.rs b/tools/yabridgectl/src/actions.rs index ea28663f..c2ab4212 100644 --- a/tools/yabridgectl/src/actions.rs +++ b/tools/yabridgectl/src/actions.rs @@ -282,7 +282,19 @@ pub fn do_sync(config: &mut Config, options: &SyncOptions) -> Result<()> { &windows_module_path, )?; - // TODO: Symlink resources and presets + // If `module` is a bundle, then it may contain a `Resources` directory with + // screenshots and documentation + // TODO: Also symlink presets, but this is a bit more involved. See + // https://steinbergmedia.github.io/vst3_doc/vstinterfaces/vst3loc.html#win7preset + if let Some(original_resources_dir) = module.original_resources_dir() { + install_file( + false, + InstallationMethod::Symlink, + &original_resources_dir, + None, + &module.target_resources_dir(), + )?; + } if options.verbose { println!(" {}", module.original_path().display()); diff --git a/tools/yabridgectl/src/files.rs b/tools/yabridgectl/src/files.rs index 1e7fe1d5..81243034 100644 --- a/tools/yabridgectl/src/files.rs +++ b/tools/yabridgectl/src/files.rs @@ -138,6 +138,23 @@ impl Vst3Module { } } + /// If this was a VST 3.6.10 style bundle, then return the path to the `Resources` directory if + /// it has one. + pub fn original_resources_dir(&self) -> Option { + match &self { + Vst3Module::Bundle(bundle_home, _) => { + let mut path = bundle_home.join("Contents"); + path.push("Resources"); + if path.exists() { + Some(path) + } else { + None + } + } + Vst3Module::Legacy(_, _) => None, + } + } + /// Get the path to the bundle in `~/.vst3` corresponding to the bridged version of this module. /// /// FIXME: How do we solve naming clashes from the same VST3 plugin being installed to multiple @@ -175,6 +192,16 @@ impl Vst3Module { path.push(self.original_module_name()); path } + + /// If the Windows VST3 plugin we're bridging was in a VST 3.6.10 style bundle and had a + /// resources directory, then we'll symlink that directory to here so the host can access all + /// its original resources. + pub fn target_resources_dir(&self) -> PathBuf { + let mut path = self.target_bundle_home(); + path.push("Contents"); + path.push("Resources"); + path + } } /// The architecture of a `.dll` file. Needed so we can create a merged bundle for VST3 plugins.