mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-22 00:20:23 +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