fn delete<P: AsRef<Path>>(directory: P, command_name: String) -> Result<(), Error> {
    let mut dir = directory.as_ref().join(PACKAGES_DIR_NAME);
    dir.push(BIN_DIR_NAME);
    if !dir.exists() {
        Ok(())
    } else {
        let script_path = dir.join(command_name.clone());
        if script_path.exists() {
            fs::remove_file(script_path)
                .map_err(|e| Error::SaveError(command_name.clone(), e.to_string()))?;
            Ok(())
        } else {
            Ok(())
        }
    }
}
/// delete the bin script for a command - for cleanup during uninstall
delete the bin script for a command - for cleanup during uninstall
delete the bin script for a command - for cleanup during uninstall
fn delete<P: AsRef<Path>>(directory: P, command_name: String) -> Result<(), Error> {
    let mut dir = directory.as_ref().join(PACKAGES_DIR_NAME);
    dir.push(BIN_DIR_NAME);
    if !dir.exists() {
        Ok(())
    } else {
        let script_path = dir.join(command_name.clone());
        if script_path.exists() {
            fs::remove_file(script_path)
                .map_err(|e| Error::SaveError(command_name.clone(), e.to_string()))?;
            Ok(())
        } else {
            Ok(())
        }
    }
}
fn delete < P : AsRef < Path > > ( directory : P , command_name : String ) -> Result < ( ) , Error > { let mut dir = directory . as_ref ( ) . join ( PACKAGES_DIR_NAME ) ; dir . push ( BIN_DIR_NAME ) ; if ! dir . exists ( ) { Ok ( ( ) ) } else { let script_path = dir . join ( command_name . clone ( ) ) ; if script_path . exists ( ) { fs :: remove_file ( script_path ) . map_err ( | e | Error :: SaveError ( command_name . clone ( ) , e . to_string ( ) ) ) ? ; Ok ( ( ) ) } else { Ok ( ( ) ) } } }
delete the bin script for a command - for cleanup during uninstall
delete the bin script for a command - for cleanup during uninstall
directory
P
command_name
String
directory
P
command_name
String