refactor: 重命名库并统一术语使用
- 将库名称从 `tauri_demo_lib` 更改为 `tauri_shell_lib` 以确保名称唯一性并避免潜在冲突。 - 更新注释以统一使用“Sidecar”术语,明确标识进程启动与清理操作 - 将主函数中的库调用从 tauri_demo_lib 更改为 tauri_shell_lib。
This commit is contained in:
@@ -11,7 +11,7 @@ edition = "2021"
|
|||||||
# The `_lib` suffix may seem redundant but it is necessary
|
# The `_lib` suffix may seem redundant but it is necessary
|
||||||
# to make the lib name unique and wouldn't conflict with the bin name.
|
# to make the lib name unique and wouldn't conflict with the bin name.
|
||||||
# This seems to be only an issue on Windows, see https://github.com/rust-lang/cargo/issues/8519
|
# This seems to be only an issue on Windows, see https://github.com/rust-lang/cargo/issues/8519
|
||||||
name = "tauri_demo_lib"
|
name = "tauri_shell_lib"
|
||||||
crate-type = ["staticlib", "cdylib", "rlib"]
|
crate-type = ["staticlib", "cdylib", "rlib"]
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ pub fn run() {
|
|||||||
// 注册全局状态
|
// 注册全局状态
|
||||||
app.manage(SidecarProcess(std::sync::Mutex::new(None)));
|
app.manage(SidecarProcess(std::sync::Mutex::new(None)));
|
||||||
|
|
||||||
// 启动 Sidecar Server 进程
|
// 启动 Sidecar 进程
|
||||||
let app_handle = app.handle().clone();
|
let app_handle = app.handle().clone();
|
||||||
sidecar::spawn_sidecar(app_handle);
|
sidecar::spawn_sidecar(app_handle);
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ pub fn run() {
|
|||||||
.build(tauri::generate_context!())
|
.build(tauri::generate_context!())
|
||||||
.expect("error while building tauri application")
|
.expect("error while building tauri application")
|
||||||
.run(|app_handle, event| {
|
.run(|app_handle, event| {
|
||||||
// 监听应用退出事件,清理 Sidecar Server 进程
|
// 监听应用退出事件,清理 Sidecar 进程
|
||||||
match event {
|
match event {
|
||||||
tauri::RunEvent::ExitRequested { .. } | tauri::RunEvent::Exit => {
|
tauri::RunEvent::ExitRequested { .. } | tauri::RunEvent::Exit => {
|
||||||
sidecar::cleanup_sidecar_process(app_handle);
|
sidecar::cleanup_sidecar_process(app_handle);
|
||||||
|
|||||||
@@ -2,5 +2,5 @@
|
|||||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
tauri_demo_lib::run()
|
tauri_shell_lib::run()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user