/// Reads the contents of a directory and returns a Vec containing the names of
/// all the binaries installed by the input package.
Reads the contents of a directory and returns a Vec containing the names of
all the binaries installed by the input package.
Reads the contents of a directory and returns a Vec containing the names of all the binaries installed by the input package .
fn binaries_from_package(package: &str) -> Fallible<Vec<String>> {
    let bin_config_dir = volta_home()?.default_bin_dir();
    if bin_config_dir.exists() {
        dir_entry_match(&bin_config_dir, |entry| {
            let path = entry.path();
            if let Ok(config) = BinConfig::from_file(path) {
                if config.package == package {
                    return Some(config.name);
                }
            };
            None
        })
        .with_context(|| ErrorKind::ReadBinConfigDirError {
            dir: bin_config_dir.to_owned(),
        })
    } else {
        Ok(vec![])
    }
}
fn binaries_from_package ( package : & str ) -> Fallible < Vec < String > > { let bin_config_dir = volta_home ( ) ? . default_bin_dir ( ) ; if bin_config_dir . exists ( ) { dir_entry_match ( & bin_config_dir , | entry | { let path = entry . path ( ) ; if let Ok ( config ) = BinConfig :: from_file ( path ) { if config . package == package { return Some ( config . name ) ; } } ; None } ) . with_context ( | | ErrorKind :: ReadBinConfigDirError { dir : bin_config_dir . to_owned ( ) , } ) } else { Ok ( vec ! [ ] ) } }
Reads the contents of a directory and returns a Vec containing the names of
all the binaries installed by the input package.
Reads the contents of a directory and returns a Vec containing the names of all the binaries installed by the input package .
package
&str