Skip to content

Commit

Permalink
Make dylint/build.rs not panic during cargo publish verification
Browse files Browse the repository at this point in the history
  • Loading branch information
smoelius committed Aug 10, 2022
1 parent 97691cd commit 0edbbe0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions dylint/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@ fn main() {

let dylint_manifest_dir = Path::new(env!("CARGO_MANIFEST_DIR"));

let dylint_driver_manifest_dir = if dylint_manifest_dir.starts_with(cargo_home) {
let dylint_driver_manifest_dir = if dylint_manifest_dir.starts_with(cargo_home)
|| dylint_manifest_dir.parent().map_or(false, |path| {
path.ends_with(Path::new("target").join("package"))
}) {
"None".to_owned()
} else {
let path = dylint_manifest_dir.join("..").join("driver");

// smoelius: Ensure the path exists at build time.
assert!(path.is_dir());
assert!(path.is_dir(), "{:?} is not a directory", path);

format!(
r#"Some("{}")"#,
Expand Down

0 comments on commit 0edbbe0

Please sign in to comment.