浏览代码

fix(tauri) addition to the previous commit

Lucas Nogueira 5 年之前
父节点
当前提交
46ea86b63a
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      tauri/src/server.rs

+ 6 - 1
tauri/src/server.rs

@@ -1,7 +1,12 @@
 use tiny_http::{Header, Response};
 
 pub fn asset_response(path: &str) -> Response<std::io::Cursor<Vec<u8>>> {
-  let asset_path = &format!("{}{}", env!("TAURI_DIST_DIR"), path);
+  let asset_path = &format!(
+    "{}{}",
+    option_env!("TAURI_DIST_DIR")
+      .expect("tauri apps should be built with the TAURI_DIST_DIR environment variable"),
+    path
+  );
   let asset = crate::assets::ASSETS
     .get(asset_path)
     .expect(&format!("Could not read asset {}", asset_path))