Skip to content

Commit

Permalink
Ensure manifest file and pyproject file paths are absolute
Browse files Browse the repository at this point in the history
  • Loading branch information
messense committed Oct 18, 2022
1 parent 37ba503 commit 7eadb90
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/project_layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,17 @@ impl ProjectResolver {
manifest_file.display()
);
}
// Sanity checks in debug build
debug_assert!(
manifest_file.is_absolute(),
"manifest_file {} is not absolute",
manifest_file.display()
);
debug_assert!(
pyproject_file.is_absolute(),
"pyproject_file {} is not absolute",
pyproject_file.display()
);

// Set Cargo manifest path
cargo_options.manifest_path = Some(manifest_file.clone());
Expand Down Expand Up @@ -243,9 +254,9 @@ impl ProjectResolver {
}
}
// check Cargo.toml in current directory
let path = PathBuf::from("Cargo.toml");
let path = current_dir.join("Cargo.toml");
if path.exists() {
Ok((path, PathBuf::from(PYPROJECT_TOML)))
Ok((path, current_dir.join(PYPROJECT_TOML)))
} else {
Err(format_err!(
"Can't find {} (in {})",
Expand Down

0 comments on commit 7eadb90

Please sign in to comment.