Add quit function
This commit is contained in:
parent
4d3f604b59
commit
0a55bb155d
7 changed files with 42 additions and 11 deletions
11
src-tauri/Cargo.lock
generated
11
src-tauri/Cargo.lock
generated
|
|
@ -911,6 +911,7 @@ dependencies = [
|
||||||
"tauri-plugin-fs",
|
"tauri-plugin-fs",
|
||||||
"tauri-plugin-opener",
|
"tauri-plugin-opener",
|
||||||
"tauri-plugin-os",
|
"tauri-plugin-os",
|
||||||
|
"tauri-plugin-process",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -3787,6 +3788,16 @@ dependencies = [
|
||||||
"thiserror 2.0.17",
|
"thiserror 2.0.17",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tauri-plugin-process"
|
||||||
|
version = "2.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d55511a7bf6cd70c8767b02c97bf8134fa434daf3926cfc1be0a0f94132d165a"
|
||||||
|
dependencies = [
|
||||||
|
"tauri",
|
||||||
|
"tauri-plugin",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tauri-runtime"
|
name = "tauri-runtime"
|
||||||
version = "2.9.2"
|
version = "2.9.2"
|
||||||
|
|
|
||||||
|
|
@ -25,4 +25,5 @@ serde_json = "1"
|
||||||
tauri-plugin-fs = "2.4.5"
|
tauri-plugin-fs = "2.4.5"
|
||||||
tauri-plugin-os = "2"
|
tauri-plugin-os = "2"
|
||||||
tauri-plugin-dialog = "2"
|
tauri-plugin-dialog = "2"
|
||||||
|
tauri-plugin-process = "2"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,14 +26,15 @@
|
||||||
},
|
},
|
||||||
"os:default",
|
"os:default",
|
||||||
"opener:default",
|
"opener:default",
|
||||||
|
{
|
||||||
|
"identifier": "opener:allow-open-path",
|
||||||
|
"allow": [
|
||||||
{
|
{
|
||||||
"identifier": "opener:allow-open-path",
|
"path": "/**"
|
||||||
"allow": [
|
}
|
||||||
{
|
]
|
||||||
"path": "/**"
|
},
|
||||||
}
|
"dialog:default",
|
||||||
]
|
"process:default"
|
||||||
},
|
|
||||||
"dialog:default"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
12
src-tauri/package-lock.json
generated
12
src-tauri/package-lock.json
generated
|
|
@ -7,7 +7,8 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tauri-apps/plugin-dialog": "^2.6.0",
|
"@tauri-apps/plugin-dialog": "^2.6.0",
|
||||||
"@tauri-apps/plugin-opener": "^2.5.3",
|
"@tauri-apps/plugin-opener": "^2.5.3",
|
||||||
"@tauri-apps/plugin-os": "^2.3.2"
|
"@tauri-apps/plugin-os": "^2.3.2",
|
||||||
|
"@tauri-apps/plugin-process": "^2.3.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@tauri-apps/api": {
|
"node_modules/@tauri-apps/api": {
|
||||||
|
|
@ -46,6 +47,15 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tauri-apps/api": "^2.8.0"
|
"@tauri-apps/api": "^2.8.0"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@tauri-apps/plugin-process": {
|
||||||
|
"version": "2.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@tauri-apps/plugin-process/-/plugin-process-2.3.1.tgz",
|
||||||
|
"integrity": "sha512-nCa4fGVaDL/B9ai03VyPOjfAHRHSBz5v6F/ObsB73r/dA3MHHhZtldaDMIc0V/pnUw9ehzr2iEG+XkSEyC0JJA==",
|
||||||
|
"license": "MIT OR Apache-2.0",
|
||||||
|
"dependencies": {
|
||||||
|
"@tauri-apps/api": "^2.8.0"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tauri-apps/plugin-dialog": "^2.6.0",
|
"@tauri-apps/plugin-dialog": "^2.6.0",
|
||||||
"@tauri-apps/plugin-opener": "^2.5.3",
|
"@tauri-apps/plugin-opener": "^2.5.3",
|
||||||
"@tauri-apps/plugin-os": "^2.3.2"
|
"@tauri-apps/plugin-os": "^2.3.2",
|
||||||
|
"@tauri-apps/plugin-process": "^2.3.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ fn rename(invoke_message: String) {
|
||||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||||
pub fn run() {
|
pub fn run() {
|
||||||
tauri::Builder::default()
|
tauri::Builder::default()
|
||||||
|
.plugin(tauri_plugin_process::init())
|
||||||
.plugin(tauri_plugin_opener::init())
|
.plugin(tauri_plugin_opener::init())
|
||||||
.plugin(tauri_plugin_dialog::init())
|
.plugin(tauri_plugin_dialog::init())
|
||||||
.plugin(tauri_plugin_os::init())
|
.plugin(tauri_plugin_os::init())
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ const { invoke } = window.__TAURI__.core;
|
||||||
const os = window.__TAURI__.os;
|
const os = window.__TAURI__.os;
|
||||||
const dialog = window.__TAURI__.dialog;
|
const dialog = window.__TAURI__.dialog;
|
||||||
const opener = window.__TAURI__.opener;
|
const opener = window.__TAURI__.opener;
|
||||||
|
const process = window.__TAURI__.process;
|
||||||
|
|
||||||
const separator = os.family() == "windows" ? "\\" : "/";
|
const separator = os.family() == "windows" ? "\\" : "/";
|
||||||
|
|
||||||
|
|
@ -238,3 +239,8 @@ app.ports.createDirectory.subscribe(function (dirPath) {
|
||||||
app.ports.receiveError.send(msg);
|
app.ports.receiveError.send(msg);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Quit the app
|
||||||
|
app.ports.quit.subscribe(function () {
|
||||||
|
process.exit();
|
||||||
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue