[yabridgectl] Show VST3 module type and arch

In `yabridgectl status`.
This commit is contained in:
Robbert van der Helm
2021-02-26 15:08:29 +01:00
parent e6ec8819cb
commit ebd6c95ceb
3 changed files with 37 additions and 8 deletions
+3
View File
@@ -29,6 +29,9 @@ Versioning](https://semver.org/spec/v2.0.0.html).
- Changed the wording in `yabridgectl status` for plugins that have not been - Changed the wording in `yabridgectl status` for plugins that have not been
setup yet to look less dramatic and hopefully cause less confusion. setup yet to look less dramatic and hopefully cause less confusion.
- Aside from the installation status, `yabridgectl status` now also shows a
plugin's type and architecture. This is color coded to make it easier to
visually parse the output.
- Plugin paths printed during `yabridgectl status` and - Plugin paths printed during `yabridgectl status` and
`yabridgectl sync --verbose` are now always shown relative to the plugin `yabridgectl sync --verbose` are now always shown relative to the plugin
location instead of repeating the same path prefix for every plugin. location instead of repeating the same path prefix for every plugin.
+13 -2
View File
@@ -121,7 +121,17 @@ pub fn show_status(config: &Config) -> Result<()> {
// be added both with and without a trailing slash // be added both with and without a trailing slash
println!("\n{}", path.join("").display()); println!("\n{}", path.join("").display());
for (plugin, status) in search_results.installation_status() { for (plugin, (status, vst3_module)) in search_results.installation_status() {
let plugin_type = match vst3_module {
Some(module) => format!(
"{}, {}, {}",
"VST3".magenta(),
module.type_str(),
module.architecture
),
None => "VST2".cyan().to_string(),
};
let status_str = match status { let status_str = match status {
Some(NativeFile::Regular(_)) => "copy".green(), Some(NativeFile::Regular(_)) => "copy".green(),
Some(NativeFile::Symlink(_)) => "symlink".green(), Some(NativeFile::Symlink(_)) => "symlink".green(),
@@ -130,8 +140,9 @@ pub fn show_status(config: &Config) -> Result<()> {
}; };
println!( println!(
" {} :: {}", " {} :: {}, {}",
plugin.strip_prefix(path).unwrap_or(&plugin).display(), plugin.strip_prefix(path).unwrap_or(&plugin).display(),
plugin_type,
status_str status_str
); );
} }
+21 -6
View File
@@ -213,6 +213,14 @@ impl Vst3Module {
path.push("Resources"); path.push("Resources");
path path
} }
/// Get a textual representation of the module type. Used in `yabridgectl status`.
pub fn type_str(&self) -> &str {
match &self.module {
Vst3ModuleType::Legacy(_) => "legacy",
Vst3ModuleType::Bundle(_) => "bundle",
}
}
} }
/// The architecture of a `.dll` file. Needed so we can create a merged bundle for VST3 plugins. /// The architecture of a `.dll` file. Needed so we can create a merged bundle for VST3 plugins.
@@ -245,8 +253,12 @@ impl LibArchitecture {
impl SearchResults { impl SearchResults {
/// For every found VST2 plugin and VST3 module, find the associated copy or symlink of /// For every found VST2 plugin and VST3 module, find the associated copy or symlink of
/// `libyabridge-{vst2,vst3}.so`. The returned hashmap will contain a `None` value for plugins /// `libyabridge-{vst2,vst3}.so`. The returned hashmap will contain a `None` value for plugins
/// that have not yet been set up. /// that have not yet been set up. For VST3 modules we'll also return the actual module since
pub fn installation_status(&self) -> BTreeMap<PathBuf, Option<NativeFile>> { /// this contains a lot of additional information we might want to print during `yabridgectl
/// status`.
pub fn installation_status(
&self,
) -> BTreeMap<PathBuf, (Option<NativeFile>, Option<&Vst3Module>)> {
let so_files: HashMap<&Path, &NativeFile> = self let so_files: HashMap<&Path, &NativeFile> = self
.so_files .so_files
.iter() .iter()
@@ -254,13 +266,13 @@ impl SearchResults {
.collect(); .collect();
// Do this for the VST2 plugins // Do this for the VST2 plugins
let mut installation_status: BTreeMap<PathBuf, Option<NativeFile>> = self let mut installation_status: BTreeMap<PathBuf, (_, _)> = self
.vst2_files .vst2_files
.iter() .iter()
.map( .map(
|path| match so_files.get(path.with_extension("so").as_path()) { |path| match so_files.get(path.with_extension("so").as_path()) {
Some(&file_type) => (path.clone(), Some(file_type.clone())), Some(&file_type) => (path.clone(), (Some(file_type.clone()), None)),
None => (path.clone(), None), None => (path.clone(), (None, None)),
}, },
) )
.collect(); .collect();
@@ -270,7 +282,10 @@ impl SearchResults {
installation_status.extend(self.vst3_modules.iter().map(|module| { installation_status.extend(self.vst3_modules.iter().map(|module| {
( (
module.original_path().to_owned(), module.original_path().to_owned(),
get_file_type(module.target_native_module_path()), (
get_file_type(module.target_native_module_path()),
Some(module),
),
) )
})); }));