From c7b94d8fdc667ef5fbe48229c347212a7fb4334e Mon Sep 17 00:00:00 2001 From: Colin Rofls Date: Thu, 17 Nov 2022 08:39:16 -0500 Subject: [PATCH] Allow relative paths with --manifest-path --- src/app.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/app.rs b/src/app.rs index c8e4ab6..b161d9b 100644 --- a/src/app.rs +++ b/src/app.rs @@ -28,10 +28,13 @@ pub(crate) fn run(app_config: AppConfig) -> Result<()> { // 3. Build the specified target let cargo_config = Config::default()?; - let manifest_path = app_config - .manifest_path - .clone() - .map_or_else(|| important_paths::find_root_manifest_for_wd(cargo_config.cwd()), Ok)?; + + let manifest_path = match app_config.manifest_path.as_ref() { + Some(path) if path.is_absolute() => Ok(path.to_owned()), + Some(path) => Ok(cargo_config.cwd().join(path)), + None => important_paths::find_root_manifest_for_wd(cargo_config.cwd()), + }?; + let workspace = Workspace::new(&manifest_path, &cargo_config)?; // 3.1: warn if --open passed. We do this here so we have access to cargo's