about summary refs log tree commit diff
path: root/src/libstd/sys/windows
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-07-21 06:27:15 +0000
committerbors <bors@rust-lang.org>2015-07-21 06:27:15 +0000
commit691ce23479b08a292ad106606dab347306fc381f (patch)
treeaa27fda2cab7a9c04c4aa00fce52fe8e466659b4 /src/libstd/sys/windows
parentf9f0e44b339ee5f1336c3a250d3b962db21df7e6 (diff)
parent1e79917bda90d3b7ea53fc08b0c0c4862dfdca53 (diff)
downloadrust-691ce23479b08a292ad106606dab347306fc381f.tar.gz
rust-691ce23479b08a292ad106606dab347306fc381f.zip
Auto merge of #27150 - retep998:where-are-my-files, r=alexcrichton
cc #24570

r? @alexcrichton 
Diffstat (limited to 'src/libstd/sys/windows')
-rw-r--r--src/libstd/sys/windows/fs.rs24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/libstd/sys/windows/fs.rs b/src/libstd/sys/windows/fs.rs
index 5dd84e9f71e..4ce6d53cf12 100644
--- a/src/libstd/sys/windows/fs.rs
+++ b/src/libstd/sys/windows/fs.rs
@@ -369,10 +369,13 @@ impl FromInner<libc::HANDLE> for File {
 
 impl fmt::Debug for File {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        // FIXME(#24570): add more info here (e.g. path, mode)
-        f.debug_struct("File")
-            .field("handle", &self.handle.raw())
-            .finish()
+        // FIXME(#24570): add more info here (e.g. mode)
+        let mut b = f.debug_struct("File");
+        b.field("handle", &self.handle.raw());
+        if let Ok(path) = get_path(&self) {
+            b.field("path", &path);
+        }
+        b.finish()
     }
 }
 
@@ -582,11 +585,7 @@ pub fn utimes(p: &Path, atime: u64, mtime: u64) -> io::Result<()> {
     Ok(())
 }
 
-pub fn canonicalize(p: &Path) -> io::Result<PathBuf> {
-
-    let mut opts = OpenOptions::new();
-    opts.read(true);
-    let f = try!(File::open(p, &opts));
+fn get_path(f: &File) -> io::Result<PathBuf> {
     super::fill_utf16_buf(|buf, sz| unsafe {
         c::GetFinalPathNameByHandleW(f.handle.raw(), buf, sz,
                                      libc::VOLUME_NAME_DOS)
@@ -595,6 +594,13 @@ pub fn canonicalize(p: &Path) -> io::Result<PathBuf> {
     })
 }
 
+pub fn canonicalize(p: &Path) -> io::Result<PathBuf> {
+    let mut opts = OpenOptions::new();
+    opts.read(true);
+    let f = try!(File::open(p, &opts));
+    get_path(&f)
+}
+
 pub fn copy(from: &Path, to: &Path) -> io::Result<u64> {
     unsafe extern "system" fn callback(
         _TotalFileSize: libc::LARGE_INTEGER,