Rename fshelper to filesystem

This commit is contained in:
sharkdp 2020-04-03 12:04:47 +02:00 committed by David Peter
parent e0cba4b700
commit b415d7234b
3 changed files with 12 additions and 12 deletions

View File

@ -4,9 +4,9 @@ mod error;
mod app;
mod exec;
mod exit_codes;
mod filesystem;
mod filetypes;
mod filter;
mod fshelper;
mod options;
mod output;
mod regex_helper;
@ -40,7 +40,7 @@ fn main() {
// Set the current working directory of the process
if let Some(base_directory) = matches.value_of("base-directory") {
let basedir = Path::new(base_directory);
if !fshelper::is_dir(basedir) {
if !filesystem::is_dir(basedir) {
print_error_and_exit!(
"The '--base-directory' path ('{}') is not a directory.",
basedir.to_string_lossy()
@ -60,7 +60,7 @@ fn main() {
// Get the current working directory
let current_dir = Path::new(".");
if !fshelper::is_dir(current_dir) {
if !filesystem::is_dir(current_dir) {
print_error_and_exit!("Could not get current directory.");
}
@ -72,7 +72,7 @@ fn main() {
Some(paths) => paths
.map(|path| {
let path_buffer = PathBuf::from(path);
if !fshelper::is_dir(&path_buffer) {
if !filesystem::is_dir(&path_buffer) {
print_error_and_exit!(
"'{}' is not a directory.",
path_buffer.to_string_lossy()
@ -90,7 +90,7 @@ fn main() {
.map(|path_buffer| {
path_buffer
.canonicalize()
.and_then(|pb| fshelper::absolute_path(pb.as_path()))
.and_then(|pb| filesystem::absolute_path(pb.as_path()))
.unwrap()
})
.collect();
@ -99,7 +99,7 @@ fn main() {
// Detect if the user accidentally supplied a path instead of a search pattern
if !matches.is_present("full-path")
&& pattern.contains(std::path::MAIN_SEPARATOR)
&& fshelper::is_dir(Path::new(pattern))
&& filesystem::is_dir(Path::new(pattern))
{
print_error_and_exit!(
"The search pattern '{pattern}' contains a path-separation character ('{sep}') \

View File

@ -1,6 +1,6 @@
use crate::exec;
use crate::exit_codes::{merge_exitcodes, ExitCode};
use crate::fshelper;
use crate::filesystem;
use crate::options::Options;
use crate::output;
@ -344,7 +344,7 @@ fn spawn_senders(
let entry_path = entry.path();
let search_str: Cow<OsStr> = if config.search_full_path {
match fshelper::path_absolute_form(entry_path) {
match filesystem::path_absolute_form(entry_path) {
Ok(path_abs_buf) => Cow::Owned(path_abs_buf.as_os_str().to_os_string()),
Err(_) => {
print_error_and_exit!("Unable to retrieve absolute path.");
@ -361,14 +361,14 @@ fn spawn_senders(
}
};
if !pattern.is_match(&fshelper::osstr_to_bytes(search_str.as_ref())) {
if !pattern.is_match(&filesystem::osstr_to_bytes(search_str.as_ref())) {
return ignore::WalkState::Continue;
}
// Filter out unwanted extensions.
if let Some(ref exts_regex) = config.extensions {
if let Some(path_str) = entry_path.file_name() {
if !exts_regex.is_match(&fshelper::osstr_to_bytes(path_str)) {
if !exts_regex.is_match(&filesystem::osstr_to_bytes(path_str)) {
return ignore::WalkState::Continue;
}
} else {
@ -385,9 +385,9 @@ fn spawn_senders(
|| (file_types.executables_only
&& !entry
.metadata()
.map(|m| fshelper::is_executable(&m))
.map(|m| filesystem::is_executable(&m))
.unwrap_or(false))
|| (file_types.empty_only && !fshelper::is_empty(&entry))
|| (file_types.empty_only && !filesystem::is_empty(&entry))
|| !(entry_type.is_file() || entry_type.is_dir() || entry_type.is_symlink())
{
return ignore::WalkState::Continue;