cargo_gn icon indicating copy to clipboard operation
cargo_gn copied to clipboard

gn fails with "Root source path not found."

Open giacomocariello opened this issue 4 years ago • 0 comments

Trying to build rusty_v8 as dependency of my project, "Regenerating ninja files" phase fails because --root parameter points to non-existent directory. I suppose the problem arises because the package source is part of a workspace and therefore the target folder lives inside parent.

To make it work, I applied the following patch:

diff --git a/src/lib.rs b/src/lib.rs
index 8ce576b..b73e925 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -30,7 +30,7 @@ fn get_dirs(manifest_dir: Option<&str>) -> Dirs {
     .to_owned();
 
   let root = match manifest_dir {
-    Some(s) => env::current_dir().unwrap().join(s),
+    Some(s) => PathBuf::from(s),
     None => env::var("CARGO_MANIFEST_DIR").map(PathBuf::from).unwrap(),
   };
 

giacomocariello avatar Mar 06 '20 21:03 giacomocariello