From 2ec53c78d9cffc27f70ee7a01d497efb46a3b231 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Thu, 16 Jul 2020 15:04:07 +0200 Subject: [PATCH] Add a descriptive error when winedump is missing --- tools/yabridgectl/src/config.rs | 2 +- tools/yabridgectl/src/files.rs | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/tools/yabridgectl/src/config.rs b/tools/yabridgectl/src/config.rs index daab693d..9d8001e8 100644 --- a/tools/yabridgectl/src/config.rs +++ b/tools/yabridgectl/src/config.rs @@ -169,7 +169,7 @@ impl Config { /// Search for VST2 plugins in all of the registered plugins directories. This will return an /// error if `winedump` could not be called. - pub fn index_directories(&self) -> Result, std::io::Error> { + pub fn index_directories(&self) -> Result> { self.plugin_dirs .par_iter() .map(|path| files::index(path).map(|search_results| (path.as_path(), search_results))) diff --git a/tools/yabridgectl/src/files.rs b/tools/yabridgectl/src/files.rs index 4be2ed63..4c0d0d3f 100644 --- a/tools/yabridgectl/src/files.rs +++ b/tools/yabridgectl/src/files.rs @@ -17,6 +17,7 @@ //! Functions to index plugins and to set up yabridge for those plugins. use aho_corasick::AhoCorasick; +use anyhow::{Context, Result}; use lazy_static::lazy_static; use rayon::prelude::*; use std::collections::{BTreeMap, HashMap}; @@ -97,7 +98,7 @@ impl FoundFile { /// Search for Windows VST2 plugins and .so files under a directory. This will return an error if /// the directory does not exist, or if `winedump` could not be found. -pub fn index(directory: &Path) -> Result { +pub fn index(directory: &Path) -> Result { // First we'll find all .dll and .so files in the directory let (dll_files, so_files) = find_files(directory); @@ -116,12 +117,16 @@ pub fn index(directory: &Path) -> Result { .arg("-j") .arg("export") .arg(&path) - .output()? + .output() + .context( + "Could not find 'winedump'. In some distributions this is part of a seperate \ + Wine tools package.", + )? .stdout; Ok((path, VST2_AUTOMATON.is_match(exported_functions))) }) - .collect::>()?; + .collect::>()?; let mut vst2_files = Vec::new(); let mut skipped_files = Vec::new();