From 8f4b1050c4de0e9194680408ff3a6902b67045f8 Mon Sep 17 00:00:00 2001 From: Kornel Date: Mon, 15 Apr 2024 08:18:46 +0100 Subject: [PATCH] feat(cli): show full expected path of `frontendDist` if not found (#9459) * feat(cli): show full expected path of frontendDist --- .changes/cli-frontend-dist-expected-path.md | 6 ++++++ tooling/cli/src/build.rs | 9 +++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 .changes/cli-frontend-dist-expected-path.md diff --git a/.changes/cli-frontend-dist-expected-path.md b/.changes/cli-frontend-dist-expected-path.md new file mode 100644 index 000000000..80b85c913 --- /dev/null +++ b/.changes/cli-frontend-dist-expected-path.md @@ -0,0 +1,6 @@ +--- +"tauri-cli": patch +"@tauri-apps/cli": patch +--- + +Show full expected path of `frontendDist` when if can't be found. \ No newline at end of file diff --git a/tooling/cli/src/build.rs b/tooling/cli/src/build.rs index 2ba6c6c6e..6556a9322 100644 --- a/tooling/cli/src/build.rs +++ b/tooling/cli/src/build.rs @@ -175,9 +175,14 @@ pub fn setup( if let Some(FrontendDist::Directory(web_asset_path)) = &config_.build.frontend_dist { if !web_asset_path.exists() { + let absolute_path = web_asset_path + .parent() + .and_then(|p| p.canonicalize().ok()) + .map(|p| p.join(web_asset_path.file_name().unwrap())) + .unwrap_or_else(|| std::env::current_dir().unwrap().join(web_asset_path)); return Err(anyhow::anyhow!( - "Unable to find your web assets, did you forget to build your web app? Your frontendDist is set to \"{:?}\".", - web_asset_path + "Unable to find your web assets, did you forget to build your web app? Your frontendDist is set to \"{}\" (which is `{}`).", + web_asset_path.display(), absolute_path.display(), )); } if web_asset_path.canonicalize()?.file_name() == Some(std::ffi::OsStr::new("src-tauri")) {