Skip to content

Commit

Permalink
fix: Normalize paths before comparing them
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeMathWalker committed Jan 28, 2025
1 parent adc5d1e commit 4f7169b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ name = "cargo_manifest"
path = "src/lib.rs"

[dependencies]
path-clean = "1.0.1"
serde = { version = "1.0.114", features = ["derive"] }
thiserror = "2.0.9"
toml = { version = "0.8", default-features = false, features = [
Expand Down
13 changes: 9 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -469,10 +469,15 @@ fn process_discovered_targets(

if add_discovered_targets {
for discovered_target in discovered_targets {
if targets
.iter()
.any(|b| b.path.as_deref() == Some(&discovered_target.path))
{
let discovered_path =
path_clean::clean(std::path::PathBuf::from(&discovered_target.path));
if targets.iter().any(|b| {
let Some(path) = &b.path else {
return false;
};
let path = path_clean::clean(std::path::PathBuf::from(path));
path == discovered_path
}) {
continue;
}

Expand Down

0 comments on commit 4f7169b

Please sign in to comment.