(path: &Path)
| 944 | } |
| 945 | |
| 946 | fn normalize_relative_path(path: &Path) -> Result<PathBuf> { |
| 947 | let mut out = PathBuf::new(); |
| 948 | for component in path.components() { |
| 949 | match component { |
| 950 | Component::CurDir => {} |
| 951 | Component::Normal(part) => out.push(part), |
| 952 | Component::ParentDir => { |
| 953 | if !out.pop() { |
| 954 | bail!("Workspace boundary violation: path escapes workspace"); |
| 955 | } |
| 956 | } |
| 957 | Component::RootDir | Component::Prefix(_) => { |
| 958 | bail!("Absolute paths are not supported by this workspace backend"); |
| 959 | } |
| 960 | } |
| 961 | } |
| 962 | Ok(out) |
| 963 | } |
| 964 | |
| 965 | fn pathbuf_to_workspace_path(path: &Path) -> WorkspacePath { |
| 966 | let display = path.to_string_lossy().replace('\\', "/"); |
no test coverage detected