fn expand_paths<P: AsRef<Path>>(dependency: P, result: &mut BTreeSet<PathBuf>, recurse: bool) {
    let path = dependency.as_ref();

    if path.is_dir() {
        let paths = std::fs::read_dir(path).unwrap_or_else(|e| {
            panic!(
                "Could not read dependecy directory at path {:?}: {}",
                path, e
            )
        });
        for path in paths {
            let path = path.expect("Could not read directory entry");
            let path = path.path();
            if path.is_file() && path.extension() == Some(std::ffi::OsStr::new("winmd")) {
                result.insert(path);
            } else if path.is_dir() && recurse {
                expand_paths(path, result, recurse)
            }
        }
    } else if path.is_file() && path.extension() == Some(std::ffi::OsStr::new("winmd")) {
        result.insert(path.to_path_buf());
    } else {
        panic!("Dependency {} is not a file or directory", path.display());
    }
}
/// Returns the paths to resolved dependencies
Returns the paths to resolved dependencies
Returns the paths to resolved dependencies
fn expand_paths<P: AsRef<Path>>(dependency: P, result: &mut BTreeSet<PathBuf>, recurse: bool) {
    let path = dependency.as_ref();
    if path.is_dir() {
        let paths = std::fs::read_dir(path).unwrap_or_else(|e| {
            panic!(
                "Could not read dependecy directory at path {:?}: {}",
                path, e
            )
        });
        for path in paths {
            let path = path.expect("Could not read directory entry");
            let path = path.path();
            if path.is_file() && path.extension() == Some(std::ffi::OsStr::new("winmd")) {
                result.insert(path);
            } else if path.is_dir() && recurse {
                expand_paths(path, result, recurse)
            }
        }
    } else if path.is_file() && path.extension() == Some(std::ffi::OsStr::new("winmd")) {
        result.insert(path.to_path_buf());
    } else {
        panic!("Dependency {} is not a file or directory", path.display());
    }
}
fn expand_paths < P : AsRef < Path > > ( dependency : P , result : & mut BTreeSet < PathBuf > , recurse : bool ) { let path = dependency . as_ref ( ) ; if path . is_dir ( ) { let paths = std :: fs :: read_dir ( path ) . unwrap_or_else ( | e | { panic ! ( " " path e ) } ) ; for path in paths { let path = path . expect ( " " ) ; let path = path . path ( ) ; if path . is_file ( ) && path . extension ( ) == Some ( std :: ffi :: OsStr :: new ( " " ) ) { result . insert ( path ) ; } else if path . is_dir ( ) && recurse { expand_paths ( path , result , recurse ) } } } else if path . is_file ( ) && path . extension ( ) == Some ( std :: ffi :: OsStr :: new ( " " ) ) { result . insert ( path . to_path_buf ( ) ) ; } else { panic ! ( " " path display ( ) ) ; } }
Returns the paths to resolved dependencies
Returns the paths to resolved dependencies
dependency
P
result
&mut BTreeSet<PathBuf>
recurse
bool