From 48813becb3117a98f22c2dccb73442e278ee1d38 Mon Sep 17 00:00:00 2001 From: hatoo Date: Sat, 26 Mar 2022 16:02:02 +0900 Subject: [PATCH] Fix chdir_workspace_root() Fixed to get $CARGO_MANIFEST_DIR in runtime instead of compile time --- nih_plug_xtask/src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nih_plug_xtask/src/lib.rs b/nih_plug_xtask/src/lib.rs index 429f1453..bfd789cd 100644 --- a/nih_plug_xtask/src/lib.rs +++ b/nih_plug_xtask/src/lib.rs @@ -103,7 +103,8 @@ pub fn main_with_args(command_name: &str, mut args: impl Iterator /// Change the current directory into the Cargo workspace's root. pub fn chdir_workspace_root() -> Result<()> { - let project_root = Path::new(env!("CARGO_MANIFEST_DIR")) + let cargo_manifest_dir = std::env::var("CARGO_MANIFEST_DIR")?; + let project_root = Path::new(&cargo_manifest_dir) .parent() .context("Could not find project root")?; std::env::set_current_dir(project_root).context("Could not change to project root directory")