修改吧video打包进app

This commit is contained in:
2025-08-18 10:32:19 +08:00
parent 6fdc31b6f4
commit 5a8cad072e
2 changed files with 23 additions and 7 deletions

View File

@@ -39,23 +39,36 @@ pub fn run() {
tauri::async_runtime::spawn(async move {
let mut candidates: Vec<std::path::PathBuf> = Vec::new();
// Add current working directory (where the executable is launched from)
// 1. First priority: Check if bundled video.mp4 exists in resources
if let Ok(exe_path) = std::env::current_exe() {
if let Some(exe_dir) = exe_path.parent() {
let bundled_video = exe_dir.join("video.mp4");
log::info!("🔍 Checking bundled video: {}", bundled_video.display());
candidates.push(bundled_video);
let bundled_public_video = exe_dir.join("public").join("video.mp4");
log::info!("🔍 Checking bundled public video: {}", bundled_public_video.display());
candidates.push(bundled_public_video);
}
}
// 2. Second priority: Check current working directory (where the app is launched from)
if let Ok(cwd) = std::env::current_dir() {
log::info!("🔍 Searching in launch directory: {}", cwd.display());
candidates.push(cwd.join("video.mp4"));
candidates.push(cwd.join("public").join("video.mp4"));
}
// Also check the directory from which the executable is located
// 3. Third priority: Check app installation directory
if let Ok(exe_path) = std::env::current_exe() {
if let Some(exe_dir) = exe_path.parent() {
log::info!("🔍 Searching in executable directory: {}", exe_dir.display());
candidates.insert(0, exe_dir.join("video.mp4"));
candidates.insert(1, exe_dir.join("public").join("video.mp4"));
candidates.push(exe_dir.join("video.mp4"));
candidates.push(exe_dir.join("public").join("video.mp4"));
}
}
// Add ancestor directories (but skip the immediate parent since we already added it)
// 4. Last priority: Add ancestor directories as fallback
if let Ok(exe_path) = std::env::current_exe() {
log::info!("📁 Executable path: {}", exe_path.display());
let mut ancestor_opt = exe_path.parent().and_then(|p| p.parent());

View File

@@ -14,7 +14,10 @@
"icons/icon.icns",
"icons/icon.ico"
],
"resources": [],
"resources": [
"../public/video.mp4",
"../video.mp4"
],
"externalBin": [],
"copyright": "",
"category": "DeveloperTool",
@@ -44,7 +47,7 @@
"minWidth": 375,
"minHeight": 812,
"resizable": true,
"fullscreen": true
"fullscreen": false
}
],
"security": {