mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
21 lines
628 B
Rust
21 lines
628 B
Rust
use yazi_fs::FilesOp;
|
|
use yazi_shared::url::{UrlBuf, UrlLike};
|
|
|
|
use crate::maybe_exists;
|
|
|
|
pub trait VfsFilesOp {
|
|
fn issue_error(cwd: &UrlBuf, kind: impl Into<yazi_fs::error::Error>) -> impl Future<Output = ()>;
|
|
}
|
|
|
|
impl VfsFilesOp for FilesOp {
|
|
async fn issue_error(cwd: &UrlBuf, err: impl Into<yazi_fs::error::Error>) {
|
|
let err = err.into();
|
|
if err.kind() != std::io::ErrorKind::NotFound {
|
|
Self::IOErr(cwd.clone(), err).emit();
|
|
} else if maybe_exists(cwd).await {
|
|
Self::IOErr(cwd.clone(), err).emit();
|
|
} else if let Some((p, n)) = cwd.pair() {
|
|
Self::Deleting(p.into(), [n.to_owned()].into()).emit();
|
|
}
|
|
}
|
|
}
|