fix: bug crash when disk drop

This commit is contained in:
weisd
2024-12-16 10:02:21 +08:00
parent f6e3575a50
commit da4daee645
6 changed files with 31 additions and 6 deletions
+4
View File
@@ -265,6 +265,10 @@ pub fn os_err_to_file_err(e: io::Error) -> Error {
}
}
pub fn is_unformatted_disk(err: &Error) -> bool {
matches!(err.downcast_ref::<DiskError>(), Some(DiskError::UnformattedDisk))
}
pub fn is_err_file_not_found(err: &Error) -> bool {
matches!(err.downcast_ref::<DiskError>(), Some(DiskError::FileNotFound))
}