Skip to content

Commit

Permalink
add Error::FileSystem
Browse files Browse the repository at this point in the history
  • Loading branch information
TD-Sky authored and Byron committed Nov 30, 2022
1 parent 1fb5ad6 commit 575b8ed
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/freedesktop.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! This implementation will manage the trash according to the Freedesktop Trash specification,
//! version 1.0 found at https://specifications.freedesktop.org/trash-spec/trashspec-1.0.html
//! version 1.0 found at <https://specifications.freedesktop.org/trash-spec/trashspec-1.0.html>
//!
//! Most -if not all- Linux based desktop operating systems implement the Trash according to this specification.
//! In other words: I looked, but I could not find any Linux based desktop OS that used anything else than the
Expand Down Expand Up @@ -1033,5 +1033,5 @@ mod tests {

/// Converts a file system error to a crate `Error`
fn fsys_err_to_unknown<P: AsRef<Path>>(path: P, orig: std::io::Error) -> Error {
Error::Unknown { description: format!("Path: '{:?}'. Message: {}", path.as_ref(), orig) }
Error::FileSystem { path: path.as_ref().to_owned(), kind: orig.kind() }
}
14 changes: 14 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,20 @@ pub enum Error {
description: String,
},

/// **freedesktop only**
///
/// Error coming from file system
#[cfg(all(
unix,
not(target_os = "macos"),
not(target_os = "ios"),
not(target_os = "android")
))]
FileSystem {
path: PathBuf,
kind: std::io::ErrorKind,
},

/// One of the target items was a root folder.
/// If a list of items are requested to be removed by a single function call (e.g. `delete_all`)
/// and this error is returned, then it's guaranteed that none of the items is removed.
Expand Down

0 comments on commit 575b8ed

Please sign in to comment.