mirror of
https://github.com/sharkdp/fd
synced 2024-10-02 22:13:31 +00:00
parent
3e68733c94
commit
cbc6ddeefc
|
@ -2,6 +2,7 @@
|
|||
|
||||
## Features
|
||||
|
||||
- `--type executable`/`-t` now works on Windows, see #1051 and #1061
|
||||
|
||||
## Bugfixes
|
||||
|
||||
|
|
12
Cargo.lock
generated
12
Cargo.lock
generated
|
@ -176,6 +176,17 @@ dependencies = [
|
|||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "faccess"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "59ae66425802d6a903e268ae1a08b8c38ba143520f227a205edf4e9c7e3e26d5"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"libc",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fd-find"
|
||||
version = "8.4.0"
|
||||
|
@ -190,6 +201,7 @@ dependencies = [
|
|||
"ctrlc",
|
||||
"diff",
|
||||
"dirs-next",
|
||||
"faccess",
|
||||
"filetime",
|
||||
"globset",
|
||||
"humantime",
|
||||
|
|
|
@ -63,6 +63,9 @@ nix = { version = "0.24.2", default-features = false, features = ["signal"] }
|
|||
[target.'cfg(all(unix, not(target_os = "redox")))'.dependencies]
|
||||
libc = "0.2"
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
faccess = "0.2.4"
|
||||
|
||||
# FIXME: Re-enable jemalloc on macOS
|
||||
# jemalloc is currently disabled on macOS due to a bug in jemalloc in combination with macOS
|
||||
# Catalina. See https://github.com/sharkdp/fd/issues/498 for details.
|
||||
|
|
|
@ -7,6 +7,9 @@ use std::io;
|
|||
use std::os::unix::fs::{FileTypeExt, PermissionsExt};
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
#[cfg(windows)]
|
||||
use faccess::PathExt as _;
|
||||
|
||||
use normpath::PathExt;
|
||||
|
||||
use crate::dir_entry;
|
||||
|
@ -42,13 +45,13 @@ pub fn is_existing_directory(path: &Path) -> bool {
|
|||
}
|
||||
|
||||
#[cfg(any(unix, target_os = "redox"))]
|
||||
pub fn is_executable(md: &fs::Metadata) -> bool {
|
||||
pub fn is_executable(_: &Path, md: &fs::Metadata) -> bool {
|
||||
md.permissions().mode() & 0o111 != 0
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
pub fn is_executable(_: &fs::Metadata) -> bool {
|
||||
false
|
||||
pub fn is_executable(path: &Path, _: &fs::Metadata) -> bool {
|
||||
path.executable()
|
||||
}
|
||||
|
||||
pub fn is_empty(entry: &dir_entry::DirEntry) -> bool {
|
||||
|
|
|
@ -24,7 +24,7 @@ impl FileTypes {
|
|||
|| (self.executables_only
|
||||
&& !entry
|
||||
.metadata()
|
||||
.map(filesystem::is_executable)
|
||||
.map(|md| filesystem::is_executable(entry.path(), md))
|
||||
.unwrap_or(false))
|
||||
|| (self.empty_only && !filesystem::is_empty(entry))
|
||||
|| !(entry_type.is_file()
|
||||
|
|
Loading…
Reference in a new issue