diff --git a/src/lib.rs b/src/lib.rs index 6e8761a..958dad4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -100,7 +100,7 @@ use std::path::{Path, PathBuf}; use std::result; use std::vec; -use same_file::is_same_file; +pub use same_file::is_same_file; mod same_file; #[cfg(test)] mod tests; diff --git a/src/same_file.rs b/src/same_file.rs index 8ad15cf..b369bbf 100644 --- a/src/same_file.rs +++ b/src/same_file.rs @@ -16,8 +16,31 @@ use std::path::Path; // // ---AG -#[cfg(unix)] +/// Returns true if the two file paths may correspond to the same file. +/// +/// If there was a problem accessing either file path, then an error is +/// returned. +/// +/// Note that it's possible for this to produce a false positive on some +/// platforms. Namely, this can return true even if the two file paths *don't* +/// resolve to the same file. +/// +/// # Example +/// +/// ```rust,no_run +/// use walkdir::is_same_file; +/// +/// assert!(is_same_file("./foo", "././foo").unwrap_or(false)); +/// ``` pub fn is_same_file
(
+ path1: P,
+ path2: Q,
+) -> io::Result (
p1: P,
p2: Q,
) -> io::Result (
+fn impl_is_same_file (
p1: P,
p2: Q,
) -> io::Result