Find the root of the workspace, not this crate, which is what `env!("CARGO_MANIFEST_DIR")` would return
()
| 156 | |
| 157 | // Find the root of the workspace, not this crate, which is what `env!("CARGO_MANIFEST_DIR")` would return |
| 158 | fn workspace_dir() -> PathBuf { |
| 159 | let output = std::process::Command::new(env!("CARGO")) |
| 160 | .arg("locate-project") |
| 161 | .arg("--workspace") |
| 162 | .arg("--message-format=plain") |
| 163 | .output() |
| 164 | .unwrap() |
| 165 | .stdout; |
| 166 | |
| 167 | let cargo_path = Path::new(std::str::from_utf8(&output).unwrap().trim()); |
| 168 | cargo_path.parent().unwrap().to_path_buf() |
| 169 | } |