summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock2
-rw-r--r--Cargo.toml2
-rw-r--r--README.md2
-rw-r--r--src/fmt_path.rs8
4 files changed, 8 insertions, 6 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 96e2fac..8d60fa0 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4,7 +4,7 @@ version = 4
[[package]]
name = "just_fmt"
-version = "0.1.1"
+version = "0.1.2"
dependencies = [
"strip-ansi-escapes",
]
diff --git a/Cargo.toml b/Cargo.toml
index 2348af0..01a49d1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -7,7 +7,7 @@ readme = "README.md"
license = "MIT OR Apache-2.0"
repository = "https://github.com/catilgrass/just_fmt"
-version = "0.1.1"
+version = "0.1.2"
edition = "2024"
[dependencies.strip-ansi-escapes]
diff --git a/README.md b/README.md
index 722f9d0..297264e 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@ Add the dependency to your `Cargo.toml`:
```toml
[dependencies]
-just_fmt = "0.1.1"
+just_fmt = "0.1.2"
```
## License
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")]