Skip to content

Commit

Permalink
Merge pull request #69 from rust-osdev/fix-doctests
Browse files Browse the repository at this point in the history
Fix nightly breakage of doctests in workspaces
  • Loading branch information
phil-opp committed Dec 10, 2020
2 parents 0a5fa3d + ba94e67 commit 495a2c1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Changelog.md
@@ -1,5 +1,7 @@
# Unreleased

- Fix nightly breakage of doctests in workspaces ([#69](https://github.com/rust-osdev/bootimage/pull/69))

# 0.10.1 – 2020-08-03

- Parse `--version` argument without subcommand (`bootimage --version`) ([#67](https://github.com/rust-osdev/bootimage/pull/67))
Expand Down
13 changes: 12 additions & 1 deletion src/builder/mod.rs
Expand Up @@ -26,7 +26,18 @@ impl Builder {
///
/// If None is passed for `manifest_path`, it is automatically searched.
pub fn new(manifest_path: Option<PathBuf>) -> Result<Self, BuilderError> {
let manifest_path = manifest_path.unwrap_or(locate_cargo_manifest::locate_manifest()?);
let manifest_path = match manifest_path.or_else(|| {
std::env::var("CARGO_MANIFEST_DIR")
.ok()
.map(|dir| Path::new(&dir).join("Cargo.toml"))
}) {
Some(path) => path,
None => {
println!("WARNING: `CARGO_MANIFEST_DIR` env variable not set");
locate_cargo_manifest::locate_manifest()?
}
};

Ok(Builder {
manifest_path,
project_metadata: None,
Expand Down

0 comments on commit 495a2c1

Please sign in to comment.