Add a descriptive error when winedump is missing

This commit is contained in:
Robbert van der Helm
2020-07-16 15:04:07 +02:00
parent 1ee2fe4746
commit 2ec53c78d9
2 changed files with 9 additions and 4 deletions
+1 -1
View File
@@ -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<BTreeMap<&Path, SearchResults>, std::io::Error> {
pub fn index_directories(&self) -> Result<BTreeMap<&Path, SearchResults>> {
self.plugin_dirs
.par_iter()
.map(|path| files::index(path).map(|search_results| (path.as_path(), search_results)))
+8 -3
View File
@@ -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<SearchResults, std::io::Error> {
pub fn index(directory: &Path) -> Result<SearchResults> {
// 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<SearchResults, std::io::Error> {
.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::<Result<_, std::io::Error>>()?;
.collect::<Result<_>>()?;
let mut vst2_files = Vec::new();
let mut skipped_files = Vec::new();