fix parsing of cargo locate-project output

Deserializing the output of `cargo locate-project --workspace` failed
for a windows user, with the error message from serde that `root` is a
string and not a path. Hopefully, using a string directly will also
work on Windows.
This commit is contained in:
Remo Senekowitsch
2026-09-21 15:51:46 +02:00
parent a650509c78
commit 359ece4d27
+2 -2
View File
@@ -20,7 +20,7 @@ use crate::{
#[derive(Deserialize)] #[derive(Deserialize)]
struct CargoLocateProject<'a> { struct CargoLocateProject<'a> {
#[serde(borrow)] #[serde(borrow)]
root: &'a Path, root: &'a str,
} }
pub fn init() -> Result<()> { pub fn init() -> Result<()> {
@@ -74,7 +74,7 @@ pub fn init() -> Result<()> {
.root; .root;
let workspace_manifest_content = fs::read_to_string(workspace_manifest) let workspace_manifest_content = fs::read_to_string(workspace_manifest)
.with_context(|| format!("Failed to read the file {}", workspace_manifest.display()))?; .with_context(|| format!("Failed to read the file {}", workspace_manifest))?;
if !workspace_manifest_content.contains("[workspace]") if !workspace_manifest_content.contains("[workspace]")
&& !workspace_manifest_content.contains("workspace.") && !workspace_manifest_content.contains("workspace.")
{ {