diff --git a/core/tauri-codegen/src/context.rs b/core/tauri-codegen/src/context.rs index 811189b4f..cbaf22e66 100644 --- a/core/tauri-codegen/src/context.rs +++ b/core/tauri-codegen/src/context.rs @@ -14,11 +14,12 @@ pub struct ContextData { /// Build an `AsTauriContext` implementation for including in application code. pub fn context_codegen(data: ContextData) -> Result { let ContextData { - config, + mut config, config_parent, struct_ident, } = data; let dist_dir = config_parent.join(&config.build.dist_dir); + config.build.dist_dir = dist_dir.to_string_lossy().to_string(); // generate the assets inside the dist dir into a perfect hash function let assets = EmbeddedAssets::new(&dist_dir)?; diff --git a/tauri/src/app/utils.rs b/tauri/src/app/utils.rs index 757cec38a..4a921ad3e 100644 --- a/tauri/src/app/utils.rs +++ b/tauri/src/app/utils.rs @@ -216,17 +216,13 @@ pub(super) fn build_webview( .canonicalize() .or_else(|_| Err(crate::Error::AssetNotFound(path.clone()))) .and_then(|pathbuf| { - if pathbuf.is_file() && pathbuf.starts_with(&dist_dir) { - match std::fs::read(pathbuf) { - Ok(asset) => return Ok(asset), - Err(e) => { - #[cfg(debug_assertions)] - eprintln!("Error reading asset from dist: {:?}", e); // TODO log::error! - } + match std::fs::read(pathbuf) { + Ok(asset) => Ok(asset), + Err(e) => { + eprintln!("Error reading asset from dist: {:?}", e); // TODO log::error! + Err(crate::Error::AssetNotFound(path.clone())) } } - - Err(crate::Error::AssetNotFound(path)) }) }) }