From 3d097a5bc62d147eaab293f7aeca2c9297a4a64e Mon Sep 17 00:00:00 2001 From: David Sherret Date: Mon, 14 Feb 2022 19:47:14 -0500 Subject: [PATCH] Maybe fix mac. --- cli/tests/integration/vendor_tests.rs | 9 +++++---- cli/tools/vendor/mod.rs | 16 +++++++++++----- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/cli/tests/integration/vendor_tests.rs b/cli/tests/integration/vendor_tests.rs index 889bd30d3bf2c7..80ce455bc666de 100644 --- a/cli/tests/integration/vendor_tests.rs +++ b/cli/tests/integration/vendor_tests.rs @@ -2,6 +2,7 @@ use deno_core::serde_json; use deno_core::serde_json::json; +use deno_runtime::fs_util; use pretty_assertions::assert_eq; use std::fs; use std::process::Stdio; @@ -30,11 +31,11 @@ fn output_dir_exists() { String::from_utf8_lossy(&output.stderr).trim(), format!( concat!( - "error: Directory {} was not empty. Please provide an empty ", + "error: Output directory {} was not empty. Please provide an empty ", "directory or use --force to ignore this error and potentially ", "overwrite its contents.", ), - vendor_dir.display(), + fs_util::canonicalize_path(&vendor_dir).unwrap().display(), ), ); assert!(!output.status.success()); @@ -55,11 +56,11 @@ fn output_dir_exists() { String::from_utf8_lossy(&output.stderr).trim(), format!( concat!( - "error: Directory {} was not empty. Please provide an empty ", + "error: Output directory {} was not empty. Please provide an empty ", "directory or use --force to ignore this error and potentially ", "overwrite its contents.", ), - vendor_dir.display(), + fs_util::canonicalize_path(&vendor_dir).unwrap().display(), ), ); assert!(!output.status.success()); diff --git a/cli/tools/vendor/mod.rs b/cli/tools/vendor/mod.rs index e46b9938405d39..01187efdb0259b 100644 --- a/cli/tools/vendor/mod.rs +++ b/cli/tools/vendor/mod.rs @@ -34,12 +34,18 @@ fn resolve_and_validate_output_dir( flags: &VendorFlags, ps: &ProcState, ) -> Result { - let output_dir = match &flags.output_path { - Some(output_path) => resolve_from_cwd(output_path)?, - None => std::env::current_dir()?.join("vendor"), - }; + let output_dir = resolve_from_cwd(&match &flags.output_path { + Some(output_path) => output_path.to_owned(), + None => PathBuf::from("vendor"), + })?; if !flags.force && !is_dir_empty(&output_dir)? { - bail!("Directory {} was not empty. Please provide an empty directory or use --force to ignore this error and potentially overwrite its contents.", output_dir.display()); + bail!( + concat!( + "Output directory {} was not empty. Please provide an empty directory or use ", + "--force to ignore this error and potentially overwrite its contents.", + ), + output_dir.display(), + ); } // check the import map