mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-20 07:30:22 +01:00
f929b3f7ce
## Summary Another follow-up of #64149 The old `strip_prefix` did not only do the stripping, but also had the functionality to build `RelPath`; this PR removes the `RelPath` building part. It also reimplements this method based on components instead of strings, which gives us the ability to handle non-UTF-8 paths and Windows prefixes reliably. Most of the callers of `PathStyle::strip_prefix()` are replaced by the following chain: ```rust PathStyle::strip_prefix() .ok() .and_then(|path| RelPath::new(path, path_style).ok()) ``` In certain places, RelPath is not needed, and the updated `strip_prefix` gives a direct result. ## Testing Added new tests to guard `PathStyle::strip_prefix`'s functionality. Tests passed for the crates where the callers live. ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - N/A
28 lines
456 B
TOML
28 lines
456 B
TOML
[package]
|
|
name = "path"
|
|
version = "0.1.0"
|
|
edition.workspace = true
|
|
publish.workspace = true
|
|
license = "Apache-2.0"
|
|
|
|
[lib]
|
|
path = "src/path.rs"
|
|
doctest = false
|
|
|
|
[features]
|
|
test-support = []
|
|
|
|
[dependencies]
|
|
anyhow.workspace = true
|
|
dunce.workspace = true
|
|
serde = { workspace = true, features = ["derive"], optional = true }
|
|
|
|
[target.'cfg(windows)'.dependencies]
|
|
tendril.workspace = true
|
|
|
|
[dev-dependencies]
|
|
tempfile.workspace = true
|
|
|
|
[lints]
|
|
workspace = true
|