Detects the repository root based on `CARGO_MANIFEST_DIR`. This is intended for use from binaries inside the workspace.
()
| 52 | /// |
| 53 | /// This is intended for use from binaries inside the workspace. |
| 54 | pub fn detect() -> Result<Self> { |
| 55 | let manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")); |
| 56 | |
| 57 | let root = manifest_dir.parent().ok_or_else(|| { |
| 58 | DataFusionError::Execution( |
| 59 | "CARGO_MANIFEST_DIR does not have a parent".to_string(), |
| 60 | ) |
| 61 | })?; |
| 62 | |
| 63 | Ok(Self { |
| 64 | root: root.to_path_buf(), |
| 65 | }) |
| 66 | } |
| 67 | |
| 68 | /// Returns the repository root directory. |
| 69 | pub fn root(&self) -> &Path { |