Эх сурвалжийг харах

feat(cli): show full expected path of `frontendDist` if not found (#9459)

* feat(cli): show full expected path of frontendDist
Kornel 1 жил өмнө
parent
commit
8f4b1050c4

+ 6 - 0
.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.

+ 7 - 2
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")) {