pub async fn do_file_operation(
    project: &model::Project,
    source: &std::path::Path,
    dest_dir: &std::path::Path,
    operation: FileOperation,
) -> FallibleResult {
    let json_rpc = project.json_rpc();
    let ls_source = from_file_browser_path(source)?;
    let ls_dest = from_file_browser_path(dest_dir)?;
    let src_name = ls_source
        .file_name()
        .ok_or_else(|| InvalidSourceFile { path: source.to_string_lossy().to_string() })?;
    let dest_name = pick_non_colliding_name(&*json_rpc, &ls_dest, src_name).await?;
    let dest_full = ls_dest.append_im(dest_name);
    match operation {
        FileOperation::Copy => json_rpc.copy_file(&ls_source, &dest_full).await?,
        FileOperation::Move => json_rpc.move_file(&ls_source, &dest_full).await?,
    }
    Ok(())
}
/// Do copy or move file operation. The destination must be a directory. If the destination already
/// contains file with the same name as source's, the moved/copy file name will be altered
/// according to algorithm described in [`pick_non_colliding_name`] docs.
Do copy or move file operation. The destination must be a directory. If the destination already
contains file with the same name as source's, the moved/copy file name will be altered
according to algorithm described in [`pick_non_colliding_name`] docs.
Do copy or move file operation . The destination must be a directory . If the destination already contains file with the same name as source ' s the moved / copy file name will be altered according to algorithm described in [ ` pick_non_colliding_name ` ] docs .
pub async fn do_file_operation(
    project: &model::Project,
    source: &std::path::Path,
    dest_dir: &std::path::Path,
    operation: FileOperation,
) -> FallibleResult {
    let json_rpc = project.json_rpc();
    let ls_source = from_file_browser_path(source)?;
    let ls_dest = from_file_browser_path(dest_dir)?;
    let src_name = ls_source
        .file_name()
        .ok_or_else(|| InvalidSourceFile { path: source.to_string_lossy().to_string() })?;
    let dest_name = pick_non_colliding_name(&*json_rpc, &ls_dest, src_name).await?;
    let dest_full = ls_dest.append_im(dest_name);
    match operation {
        FileOperation::Copy => json_rpc.copy_file(&ls_source, &dest_full).await?,
        FileOperation::Move => json_rpc.move_file(&ls_source, &dest_full).await?,
    }
    Ok(())
}
pub async fn do_file_operation ( project : & model :: Project , source : & std :: path :: Path , dest_dir : & std :: path :: Path , operation : FileOperation , ) -> FallibleResult { let json_rpc = project . json_rpc ( ) ; let ls_source = from_file_browser_path ( source ) ? ; let ls_dest = from_file_browser_path ( dest_dir ) ? ; let src_name = ls_source . file_name ( ) . ok_or_else ( | | InvalidSourceFile { path : source . to_string_lossy ( ) . to_string ( ) } ) ? ; let dest_name = pick_non_colliding_name ( & * json_rpc , & ls_dest , src_name ) . await ? ; let dest_full = ls_dest . append_im ( dest_name ) ; match operation { FileOperation :: Copy => json_rpc . copy_file ( & ls_source , & dest_full ) . await ? , FileOperation :: Move => json_rpc . move_file ( & ls_source , & dest_full ) . await ? , } Ok ( ( ) ) }
Do copy or move file operation.
Do copy or move file operation .
project
&model::Project
source
&std::path::Path
dest_dir
&std::path::Path
operation
FileOperation
project
&model::Project
source
&std::path::Path
dest_dir
&std::path::Path
operation
FileOperation