mirror of
https://github.com/BurntSushi/walkdir.git
synced 2025-09-30 07:00:37 +00:00
small touchup
This commit is contained in:
parent
eaf24e463c
commit
07d4aef89b
16
src/lib.rs
16
src/lib.rs
@ -311,7 +311,7 @@ fn is_same_file<P, Q>(
|
||||
p2: Q,
|
||||
) -> io::Result<bool>
|
||||
where P: AsRef<Path>, Q: AsRef<Path> {
|
||||
// My hope is that most of this gets moved into `std::sys::windows`.
|
||||
// My hope is that most of this gets moved into `std::sys::windows`. ---AG
|
||||
extern crate libc;
|
||||
|
||||
use std::fs::File;
|
||||
@ -380,22 +380,12 @@ where P: AsRef<Path>, Q: AsRef<Path> {
|
||||
s.as_os_str().encode_wide().chain(Some(0)).collect()
|
||||
}
|
||||
|
||||
let h1 = try!(open_read_attr(&p1));
|
||||
let h2 = try!(open_read_attr(&p2));
|
||||
let i1 = try!(file_info(h1));
|
||||
let i2 = try!(file_info(h2));
|
||||
let i1 = try!(file_info(try!(open_read_attr(&p1))));
|
||||
let i2 = try!(file_info(try!(open_read_attr(&p2))));
|
||||
Ok((i1.dwVolumeSerialNumber, i1.nFileIndexHigh, i1.nFileIndexLow)
|
||||
== (i2.dwVolumeSerialNumber, i2.nFileIndexHigh, i2.nFileIndexLow))
|
||||
}
|
||||
|
||||
fn read_link<P: AsRef<Path>>(p: P) -> PathBuf {
|
||||
if fs::symlink_metadata(&p).unwrap().file_type().is_symlink() {
|
||||
fs::read_link(&p).unwrap()
|
||||
} else {
|
||||
p.as_ref().to_path_buf()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
fn is_same_file<P, Q>(
|
||||
p1: P,
|
||||
|
Loading…
x
Reference in New Issue
Block a user