From 40b576894f42d9499f44f9394b811dfde4d165a8 Mon Sep 17 00:00:00 2001 From: Evan Almloff Date: Mon, 8 Apr 2024 21:23:11 -0500 Subject: [PATCH] fix the assets head path (#2267) --- packages/desktop/src/protocol.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/desktop/src/protocol.rs b/packages/desktop/src/protocol.rs index 3ae967896..b294fe377 100644 --- a/packages/desktop/src/protocol.rs +++ b/packages/desktop/src/protocol.rs @@ -81,8 +81,14 @@ fn assets_head() -> Option { target_os = "openbsd" ))] { - let head = crate::protocol::get_asset_root_or_default(); - let head = head.join("dist").join("__assets_head.html"); + let root = crate::protocol::get_asset_root_or_default(); + let assets_head_path = "__assets_head.html"; + let mut head = root.join(assets_head_path); + // If we can't find it, add the dist directory and try again + // When bundling we currently copy the whole dist directory to the output directory instead of the individual files because of a limitation of cargo bundle2 + if !head.exists() { + head = root.join("dist").join(assets_head_path); + } match std::fs::read_to_string(&head) { Ok(s) => Some(s), Err(err) => {