ota
This commit is contained in:
+14
-3
@@ -1,8 +1,19 @@
|
||||
// 跨平台入口: 桌面从这里走, Android 走 mobile_entry_point 宏
|
||||
// 启动流程:
|
||||
// 1) 初始化 tauri-plugin-hotswap (前端 OTA 升级插件)
|
||||
// - 必须在 build 之前调用, 插件会替换 tauri::generate_context! 的 asset provider,
|
||||
// 后续可被 tauri::Builder 消费
|
||||
// 2) 业务初始化
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
pub fn run() {
|
||||
// 生成 context, 交给 hotswap 包装 (替换 Assets provider, 让 tauri://localhost 资源
|
||||
// 优先从本地覆盖目录读, 走不到时回退到内置 dist)
|
||||
let context = tauri::generate_context!();
|
||||
let (hotswap, context) = tauri_plugin_hotswap::init(context)
|
||||
.expect("failed to initialize tauri-plugin-hotswap");
|
||||
|
||||
tauri::Builder::default()
|
||||
.setup(|_app| Ok(()))
|
||||
.run(tauri::generate_context!())
|
||||
.plugin(hotswap)
|
||||
.run(context)
|
||||
.expect("error while running iBoard");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user