windows compatibility (#35)

windows compatibility
This commit is contained in:
Sebastiaan Vermeulen 2017-06-09 12:18:12 +02:00 committed by David Peter
parent 2ea23c0000
commit f7910c125d

View file

@ -12,6 +12,7 @@ use std::error::Error;
use std::ffi::OsStr;
use std::fs;
use std::io::Write;
#[cfg(target_family = "unix")]
use std::os::unix::fs::PermissionsExt;
use std::path::{Path, Component};
use std::process;
@ -77,6 +78,7 @@ fn print_entry(base: &Path, entry: &Path, config: &FdOptions) {
None => return
};
#[cfg(target_family = "unix")]
let is_executable = |p: &std::path::PathBuf| {
p.metadata()
.ok()
@ -84,6 +86,9 @@ fn print_entry(base: &Path, entry: &Path, config: &FdOptions) {
.unwrap_or(false)
};
#[cfg(not(target_family = "unix"))]
let is_executable = |p: &std::path::PathBuf| {false};
if let Some(ref ls_colors) = config.ls_colors {
let mut component_path = base.to_path_buf();