diff --git a/src/lib.rs b/src/lib.rs index 7bd2f29..b32878c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -311,7 +311,7 @@ fn is_same_file( p2: Q, ) -> io::Result where P: AsRef, Q: AsRef { - // 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, Q: AsRef { 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: 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( p1: P,