summaryrefslogtreecommitdiff
path: root/utils/src/globber.rs
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-02-25 07:48:47 +0800
committer魏曹先生 <1992414357@qq.com>2026-02-25 07:48:47 +0800
commit5f3d4892a12189e88e692eabdd5f8fe68c79b23e (patch)
tree315e67e2efc2ca88d8e25aeb98626b1169241b17 /utils/src/globber.rs
parent5dd853c5371bf26d7bf3774f3c03088fb15f84a3 (diff)
Replace string_proc with just_fmt dependency
Diffstat (limited to 'utils/src/globber.rs')
-rw-r--r--utils/src/globber.rs17
1 files changed, 10 insertions, 7 deletions
diff --git a/utils/src/globber.rs b/utils/src/globber.rs
index e20caf9..7021898 100644
--- a/utils/src/globber.rs
+++ b/utils/src/globber.rs
@@ -1,6 +1,6 @@
use std::{io::Error, path::PathBuf, str::FromStr};
-use just_enough_vcs::utils::string_proc::format_path::format_path_str;
+use just_fmt::fmt_path::fmt_path_str;
use crate::globber::constants::{SPLIT_STR, get_base_dir_current};
@@ -48,10 +48,13 @@ impl Globber {
if !path.ends_with(SPLIT_STR) {
path.push_str(SPLIT_STR);
}
- (
- format_path_str(path)?,
- pattern_part[SPLIT_STR.len()..].to_string(),
- )
+ let Ok(result) = fmt_path_str(&path) else {
+ return Err(Error::new(
+ std::io::ErrorKind::InvalidInput,
+ format!("Invalid path: \"{}\"", &path),
+ ));
+ };
+ (result, pattern_part[SPLIT_STR.len()..].to_string())
} else {
(String::default(), full_path)
};
@@ -103,14 +106,14 @@ impl Globber {
match item {
GlobItem::File(file_name) => {
let relative_path = {
- format_path_str(format!("{}{}{}", current, SPLIT_STR, file_name))
+ fmt_path_str(format!("{}{}{}", current, SPLIT_STR, file_name))
.unwrap_or_default()
};
file_names.push(relative_path)
}
GlobItem::Directory(dir_name) => {
let new_current = {
- format_path_str(format!("{}{}{}", current, SPLIT_STR, dir_name))
+ fmt_path_str(format!("{}{}{}", current, SPLIT_STR, dir_name))
.unwrap_or_default()
};
collect_files(base, new_current, file_names, get_names);