Skip to content

Commit

Permalink
Fix too many path separators on Windows (#93).
Browse files Browse the repository at this point in the history
  • Loading branch information
reima authored and sharkdp committed Oct 14, 2017
1 parent b441528 commit 0677e63
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use internal::{FdOptions, PathDisplay, ROOT_DIR};
use std::{fs, process};
use std::io::{self, Write};
use std::ops::Deref;
use std::path::{self, Path, PathBuf};
use std::path::{self, Path, PathBuf, Component};
#[cfg(unix)]
use std::os::unix::fs::PermissionsExt;

Expand Down Expand Up @@ -42,6 +42,13 @@ pub fn print_entry(base: &Path, entry: &PathBuf, config: &FdOptions) {

component_path.push(Path::new(comp_str.deref()));

if let Component::RootDir = component {
// Printing the root dir would result in too many path separators on Windows.
// Note that a root dir component won't occur on Unix, because `entry` is never an
// absolute path in that case.
continue;
}

let metadata = component_path.metadata().ok();
let is_directory = metadata.as_ref().map(|md| md.is_dir()).unwrap_or(false);

Expand Down

0 comments on commit 0677e63

Please sign in to comment.