pub fn copy_file(src: &Path, dest: &PathBuf, base_path: &PathBuf, hard_link: bool) -> Result<()> {
    let relative_path = src.strip_prefix(base_path).unwrap();
    let target_path = dest.join(relative_path);

    if let Some(parent_directory) = target_path.parent() {
        create_dir_all(parent_directory).map_err(|e| {
            Error::chain(format!("Was not able to create folder {}", parent_directory.display()), e)
        })?;
    }

    copy_file_if_needed(src, &target_path, hard_link)
}
/// Copy a file but takes into account where to start the copy as
/// there might be folders we need to create on the way.
Copy a file but takes into account where to start the copy as
there might be folders we need to create on the way.
Copy a file but takes into account where to start the copy as there might be folders we need to create on the way .
pub fn copy_file(src: &Path, dest: &PathBuf, base_path: &PathBuf, hard_link: bool) -> Result<()> {
    let relative_path = src.strip_prefix(base_path).unwrap();
    let target_path = dest.join(relative_path);
    if let Some(parent_directory) = target_path.parent() {
        create_dir_all(parent_directory).map_err(|e| {
            Error::chain(format!("Was not able to create folder {}", parent_directory.display()), e)
        })?;
    }
    copy_file_if_needed(src, &target_path, hard_link)
}
pub fn copy_file ( src : & Path , dest : & PathBuf , base_path : & PathBuf , hard_link : bool ) -> Result < ( ) > { let relative_path = src . strip_prefix ( base_path ) . unwrap ( ) ; let target_path = dest . join ( relative_path ) ; if let Some ( parent_directory ) = target_path . parent ( ) { create_dir_all ( parent_directory ) . map_err ( | e | { Error :: chain ( format ! ( " " parent_directory display ( ) ) , e ) } ) ? ; } copy_file_if_needed ( src , & target_path , hard_link ) }
Copy a file but takes into account where to start the copy as
there might be folders we need to create on the way.
Copy a file but takes into account where to start the copy as there might be folders we need to create on the way .
src
&Path
dest
&PathBuf
base_path
&PathBuf
hard_link
bool
src
&Path
dest
&PathBuf
base_path
&PathBuf
hard_link
bool