Skip to content

Commit

Permalink
cargo/config: Don't canonicalize joined [env] relative paths
Browse files Browse the repository at this point in the history
Cargo doesn't do this either, and canonicalization requires the path to
exist which it does not have to.
  • Loading branch information
MarijnS95 committed Aug 17, 2023
1 parent adc955f commit 51961ac
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions xbuild/src/cargo/config.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use anyhow::{Context, Result};
use anyhow::Result;
use serde::Deserialize;
use std::{
borrow::Cow,
Expand Down Expand Up @@ -113,16 +113,13 @@ impl EnvOption {
value,
relative: true,
force: _,
} => {
let value = config_parent.as_ref().join(value);
let value = dunce::canonicalize(&value)
.with_context(|| format!("Failed to canonicalize `{}`", value.display()))?;
value
.into_os_string()
.into_string()
.map_err(VarError::NotUnicode)?
.into()
}
} => config_parent
.as_ref()
.join(value)
.into_os_string()
.into_string()
.map_err(VarError::NotUnicode)?
.into(),
Self::String(value) | Self::Value { value, .. } => value.into(),
})
}
Expand Down

0 comments on commit 51961ac

Please sign in to comment.