diff --git a/src-tauri/src/web/mod.rs b/src-tauri/src/web/mod.rs index e2c44ae..6a93ec1 100644 --- a/src-tauri/src/web/mod.rs +++ b/src-tauri/src/web/mod.rs @@ -45,20 +45,19 @@ pub(crate) fn generate_random_token() -> String { } pub(crate) fn find_static_dir(app: &tauri::AppHandle) -> PathBuf { - // 1. Production: Tauri bundles frontendDist into the resource directory. + // 1. Production: bundle.resources copies out/ → web/ inside the resource directory. let resource = app.path().resource_dir().ok(); if let Some(ref dir) = resource { - // In production builds, the HTML files are at the resource root. + let web = dir.join("web"); + if web.join("index.html").exists() { + eprintln!("[WEB] Serving static files from resource/web: {}", web.display()); + return web; + } + // Fallback: files at resource root. if dir.join("index.html").exists() { eprintln!("[WEB] Serving static files from resource dir: {}", dir.display()); return dir.clone(); } - // Or possibly in an "out" subdirectory. - let out = dir.join("out"); - if out.join("index.html").exists() { - eprintln!("[WEB] Serving static files from resource/out: {}", out.display()); - return out; - } } // 2. Dev mode: "out/" is at the project root, which is one level above src-tauri/. diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 956ae48..20cf9ec 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -25,7 +25,10 @@ "icons/128x128@2x.png", "icons/icon.icns", "icons/icon.ico" - ] + ], + "resources": { + "../out": "web/" + } }, "plugins": { "updater": {