#[cfg(feature = "parallel")]
pub mod walkdir {
use std::path::Path;
pub use jwalk::{DirEntry as DirEntryGeneric, DirEntryIter as DirEntryIterGeneric, Error, WalkDir};
pub type DirEntry = DirEntryGeneric<((), ())>;
pub fn walkdir_new(root: impl AsRef<Path>) -> WalkDir {
WalkDir::new(root).skip_hidden(false)
}
pub fn walkdir_sorted_new(root: impl AsRef<Path>) -> WalkDir {
WalkDir::new(root).sort(true)
}
pub type DirEntryIter = DirEntryIterGeneric<((), ())>;
}
#[cfg(all(feature = "walkdir", not(feature = "parallel")))]
pub mod walkdir {
use std::path::Path;
pub use walkdir::{DirEntry, Error, WalkDir};
pub fn walkdir_new(root: impl AsRef<Path>) -> WalkDir {
WalkDir::new(root)
}
pub fn walkdir_sorted_new(root: impl AsRef<Path>) -> WalkDir {
WalkDir::new(root).sort_by_file_name()
}
pub type DirEntryIter = walkdir::IntoIter;
}
#[cfg(any(feature = "walkdir", feature = "jwalk"))]
pub use self::walkdir::{walkdir_new, walkdir_sorted_new, WalkDir};
pub fn open_options_no_follow() -> std::fs::OpenOptions {
#[cfg_attr(not(unix), allow(unused_mut))]
let mut options = std::fs::OpenOptions::new();
#[cfg(unix)]
{
use std::os::unix::fs::OpenOptionsExt;
options.custom_flags(libc::O_NOFOLLOW);
}
options
}