修复github工作流打包

This commit is contained in:
xintaofei
2026-03-26 00:42:23 +08:00
parent a6e64d2d36
commit 140819b55e
2 changed files with 11 additions and 9 deletions

View File

@@ -45,20 +45,19 @@ pub(crate) fn generate_random_token() -> String {
} }
pub(crate) fn find_static_dir(app: &tauri::AppHandle) -> PathBuf { 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(); let resource = app.path().resource_dir().ok();
if let Some(ref dir) = resource { 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() { if dir.join("index.html").exists() {
eprintln!("[WEB] Serving static files from resource dir: {}", dir.display()); eprintln!("[WEB] Serving static files from resource dir: {}", dir.display());
return dir.clone(); 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/. // 2. Dev mode: "out/" is at the project root, which is one level above src-tauri/.

View File

@@ -25,7 +25,10 @@
"icons/128x128@2x.png", "icons/128x128@2x.png",
"icons/icon.icns", "icons/icon.icns",
"icons/icon.ico" "icons/icon.ico"
] ],
"resources": {
"../out": "web/"
}
}, },
"plugins": { "plugins": {
"updater": { "updater": {