Skip to content

Commit 7eadb90

Browse files
committed
Ensure manifest file and pyproject file paths are absolute
1 parent 37ba503 commit 7eadb90

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/project_layout.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,17 @@ impl ProjectResolver {
6363
manifest_file.display()
6464
);
6565
}
66+
// Sanity checks in debug build
67+
debug_assert!(
68+
manifest_file.is_absolute(),
69+
"manifest_file {} is not absolute",
70+
manifest_file.display()
71+
);
72+
debug_assert!(
73+
pyproject_file.is_absolute(),
74+
"pyproject_file {} is not absolute",
75+
pyproject_file.display()
76+
);
6677

6778
// Set Cargo manifest path
6879
cargo_options.manifest_path = Some(manifest_file.clone());
@@ -243,9 +254,9 @@ impl ProjectResolver {
243254
}
244255
}
245256
// check Cargo.toml in current directory
246-
let path = PathBuf::from("Cargo.toml");
257+
let path = current_dir.join("Cargo.toml");
247258
if path.exists() {
248-
Ok((path, PathBuf::from(PYPROJECT_TOML)))
259+
Ok((path, current_dir.join(PYPROJECT_TOML)))
249260
} else {
250261
Err(format_err!(
251262
"Can't find {} (in {})",

0 commit comments

Comments
 (0)