| Jakub Kotur | 133ff28 | 2020-12-21 17:28:16 +0100 | [diff] [blame] | 1 | same-file |
| 2 | ========= |
| 3 | A safe and cross platform crate to determine whether two files or directories |
| 4 | are the same. |
| 5 | |
| 6 | [](https://github.com/BurntSushi/same-file/actions) |
| 7 | [](https://crates.io/crates/same-file) |
| 8 | |
| 9 | Dual-licensed under MIT or the [UNLICENSE](http://unlicense.org). |
| 10 | |
| 11 | ### Documentation |
| 12 | |
| 13 | https://docs.rs/same-file |
| 14 | |
| 15 | ### Usage |
| 16 | |
| 17 | Add this to your `Cargo.toml`: |
| 18 | |
| 19 | ```toml |
| 20 | [dependencies] |
| 21 | same-file = "1" |
| 22 | ``` |
| 23 | |
| 24 | ### Example |
| 25 | |
| 26 | The simplest use of this crate is to use the `is_same_file` function, which |
| 27 | takes two file paths and returns true if and only if they refer to the same |
| 28 | file: |
| 29 | |
| 30 | ```rust,no_run |
| 31 | use same_file::is_same_file; |
| 32 | |
| 33 | fn main() { |
| 34 | assert!(is_same_file("/bin/sh", "/usr/bin/sh").unwrap()); |
| 35 | } |
| 36 | ``` |
| 37 | |
| 38 | ### Minimum Rust version policy |
| 39 | |
| 40 | This crate's minimum supported `rustc` version is `1.34.0`. |
| 41 | |
| 42 | The current policy is that the minimum Rust version required to use this crate |
| 43 | can be increased in minor version updates. For example, if `crate 1.0` requires |
| 44 | Rust 1.20.0, then `crate 1.0.z` for all values of `z` will also require Rust |
| 45 | 1.20.0 or newer. However, `crate 1.y` for `y > 0` may require a newer minimum |
| 46 | version of Rust. |
| 47 | |
| 48 | In general, this crate will be conservative with respect to the minimum |
| 49 | supported version of Rust. |