pub fn parse_safs(mut safs: Vec<PathBuf>) -> anyhow::Result<Vec<PathBuf>> {
    if safs.is_empty() {
        safs.push(std::env::current_dir()?);
    }
    for saf in safs.iter_mut() {
        if saf.is_dir() {
            let file_path = search_for_saf(&saf)?;
            *saf = file_path;
        }
        ensure!(
            saf.file_name()
                .map(|f| f.to_string_lossy().ends_with(".saf"))
                .unwrap_or(false),
            "File {} is not a valid saf file name: (e.g. my-saf.saf)",
            saf.display()
        );
    }
    Ok(safs)
}
/// Parse a list of safs.
/// If paths are directories then each directory
/// will be searched for the first file that matches
/// `*.saf`.
Parse a list of safs.
If paths are directories then each directory
will be searched for the first file that matches
`*.saf`.
Parse a list of safs . If paths are directories then each directory will be searched for the first file that matches ` * . saf ` .
pub fn parse_safs(mut safs: Vec<PathBuf>) -> anyhow::Result<Vec<PathBuf>> {
    if safs.is_empty() {
        safs.push(std::env::current_dir()?);
    }
    for saf in safs.iter_mut() {
        if saf.is_dir() {
            let file_path = search_for_saf(&saf)?;
            *saf = file_path;
        }
        ensure!(
            saf.file_name()
                .map(|f| f.to_string_lossy().ends_with(".saf"))
                .unwrap_or(false),
            "File {} is not a valid saf file name: (e.g. my-saf.saf)",
            saf.display()
        );
    }
    Ok(safs)
}
pub fn parse_safs ( mut safs : Vec < PathBuf > ) -> anyhow :: Result < Vec < PathBuf > > { if safs . is_empty ( ) { safs . push ( std :: env :: current_dir ( ) ? ) ; } for saf in safs . iter_mut ( ) { if saf . is_dir ( ) { let file_path = search_for_saf ( & saf ) ? ; * saf = file_path ; } ensure ! ( saf file_name ( ) map ( f f to_string_lossy ( ) ends_with ( " " ) ) unwrap_or ( false ) " " saf display ( ) ) ; } Ok ( safs ) }
Parse a list of safs.
Parse a list of safs .
safs
Vec<PathBuf>
safs
Vec<PathBuf>