summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-02-24 17:24:20 +0800
committerGitHub <noreply@github.com>2026-02-24 17:24:20 +0800
commitec0cafe60041bf2a1a0cfbc66c79455daaf3a3ea (patch)
tree6d9475e4ed006976ed5beb1ef7e347776e6aa6e4 /src
parent6490775f28fe36228280ac57b3a5a9e1fed9d004 (diff)
parent2cef51d7448206291b1ac92fdaf708a7e30c78a4 (diff)
Merge pull request #1 from CatilGrass/nextHEADmaster
Bump version to 0.1.2
Diffstat (limited to 'src')
-rw-r--r--src/fmt_path.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/fmt_path.rs b/src/fmt_path.rs
index d7c5fd3..90a8d64 100644
--- a/src/fmt_path.rs
+++ b/src/fmt_path.rs
@@ -40,7 +40,8 @@ impl Default for PathFormatConfig {
/// Normalize an input path string into a canonical, platform‑agnostic form.
///
-/// This function removes ANSI escape sequences, unifies separators to `/`,
+/// This function removes ANSI escape sequences (requires `strip-ansi` feature),
+/// unifies separators to `/`,
/// collapses duplicate slashes, strips unfriendly characters (`*`, `?`, `"`, `<`, `>`, `|`),
/// resolves simple `..` components, and preserves a trailing slash when present.
///
@@ -80,7 +81,8 @@ pub fn fmt_path_str(path: impl Into<String>) -> Result<String, PathFormatError>
/// Normalize an input path string into a canonical, platform‑agnostic form.
///
-/// This function removes ANSI escape sequences, unifies separators to `/`,
+/// This function removes ANSI escape sequences (requires `strip-ansi` feature),
+/// unifies separators to `/`,
/// collapses duplicate slashes, strips unfriendly characters (`*`, `?`, `"`, `<`, `>`, `|`),
/// resolves simple `..` components, and preserves a trailing slash when present.
///
@@ -92,7 +94,7 @@ pub fn fmt_path_str_custom(
config: &PathFormatConfig,
) -> Result<String, PathFormatError> {
let path_result = path.into();
- let ends_with_slash = path_result.ends_with('/');
+ let ends_with_slash = path_result.ends_with('/') || path_result.ends_with('\\');
// ANSI Strip
#[cfg(feature = "strip-ansi")]