Skip to content

Commit

Permalink
Fix unfound manifest error when CARGO_TARGET_DIR is set
Browse files Browse the repository at this point in the history
  • Loading branch information
hwittenborn committed Jun 3, 2024
1 parent 8a73713 commit 9ebca34
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ fn path_to_icon_name(string: &OsStr) -> String {

fn main() {
let out_dir = env::var("OUT_DIR").unwrap();
let mut manifest_dir = Path::new(&out_dir).canonicalize().unwrap();
eprintln!("Canonical manifest dir: {manifest_dir:?}");
let manifest_dir = env::var("PWD").unwrap();
let mut manifest_path = Path::new(&manifest_dir).canonicalize().unwrap();

let (config, config_dir) = if cfg!(docsrs) {
if let Ok(source_dir) = env::var("SOURCE_DIR") {
Expand All @@ -63,12 +63,12 @@ fn main() {
// of the user.
// Unfortunately, the CARGO_MANIFEST_DIR env var passed by cargo always points
// to this crate, so we wouldn't find the users config file this way.
while !manifest_dir.join("Cargo.toml").exists() {
if !manifest_dir.pop() {
while !manifest_path.join("Cargo.toml").exists() {
if !manifest_path.pop() {
panic!("Couldn't find your manifest directory");
}
}
let config_dir = manifest_dir
let config_dir = manifest_path
.to_str()
.expect("Couldn't convert manifest directory to string")
.to_owned();
Expand Down

0 comments on commit 9ebca34

Please sign in to comment.