fn copy_files_into_dir(files: &[PathBuf], target_dir: &PathBuf, b: &Behavior) -> i32 {
    if !target_dir.is_dir() {
        show_error!("target '{}' is not a directory", target_dir.display());
        return 1;
    }

    let mut all_successful = true;
    for sourcepath in files.iter() {
        let targetpath = match sourcepath.as_os_str().to_str() {
            Some(name) => target_dir.join(name),
            None => {
                show_error!(
                    "cannot stat '{}': No such file or directory",
                    sourcepath.display()
                );

                all_successful = false;
                continue;
            }
        };

        if copy(sourcepath, &targetpath, b).is_err() {
            all_successful = false;
        }
    }
    if all_successful {
        0
    } else {
        1
    }
}
/// Copy some files into a directory.
///
/// Prints verbose information and error messages.
/// Returns an integer intended as a program return code.
///
/// # Parameters
///
/// _files_ must all exist as non-directories.
/// _target_dir_ must be a directory.
///
Copy some files into a directory.
Prints verbose information and error messages.
Returns an integer intended as a program return code.
Copy some files into a directory . Prints verbose information and error messages . Returns an integer intended as a program return code .
fn copy_files_into_dir(files: &[PathBuf], target_dir: &PathBuf, b: &Behavior) -> i32 {
    if !target_dir.is_dir() {
        show_error!("target '{}' is not a directory", target_dir.display());
        return 1;
    }
    let mut all_successful = true;
    for sourcepath in files.iter() {
        let targetpath = match sourcepath.as_os_str().to_str() {
            Some(name) => target_dir.join(name),
            None => {
                show_error!(
                    "cannot stat '{}': No such file or directory",
                    sourcepath.display()
                );
                all_successful = false;
                continue;
            }
        };
        if copy(sourcepath, &targetpath, b).is_err() {
            all_successful = false;
        }
    }
    if all_successful {
        0
    } else {
        1
    }
}
fn copy_files_into_dir ( files : & [ PathBuf ] , target_dir : & PathBuf , b : & Behavior ) -> i32 { if ! target_dir . is_dir ( ) { show_error ! ( " " target_dir display ( ) ) ; return 1 ; } let mut all_successful = true ; for sourcepath in files . iter ( ) { let targetpath = match sourcepath . as_os_str ( ) . to_str ( ) { Some ( name ) => target_dir . join ( name ) , None => { show_error ! ( " " sourcepath display ( ) ) ; all_successful = false ; continue ; } } ; if copy ( sourcepath , & targetpath , b ) . is_err ( ) { all_successful = false ; } } if all_successful { 0 } else { 1 } }
Copy some files into a directory.
Copy some files into a directory .
files
&[PathBuf]
target_dir
&PathBuf
b
&Behavior
files
&[PathBuf]
target_dir
&PathBuf
b
&Behavior