A safe and cross platform crate to determine whether two files or directories are the same.
Dual-licensed under MIT or the UNLICENSE.
Add this to your Cargo.toml
:
[dependencies]
same-file = "1"
The simplest use of this crate is to use the is_same_file
function, which
takes two file paths and returns true if and only if they refer to the same
file:
use same_file::is_same_file;
fn main() {
assert!(is_same_file("/bin/sh", "/usr/bin/sh").unwrap());
}
This crate's minimum supported rustc
version is 1.60.0
.
The current policy is that the minimum Rust version required to use this crate
can be increased in minor version updates. For example, if crate 1.0
requires
Rust 1.20.0, then crate 1.0.z
for all values of z
will also require Rust
1.20.0 or newer. However, crate 1.y
for y > 0
may require a newer minimum
version of Rust.
In general, this crate will be conservative with respect to the minimum supported version of Rust.