Skip to content

Commit 30b413f

Browse files
authored
feat: add stub configuration (#11)
1 parent 3acf5bc commit 30b413f

File tree

18 files changed

+1991
-6
lines changed

18 files changed

+1991
-6
lines changed

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ src-tauri
1010
src-tauri/target
1111
src-tauri/gen
1212
sftool-lib
13+
**/*.svg

src-tauri/Cargo.lock

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-tauri/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ serde_json = "1"
2626
tauri-plugin-store = "2"
2727
tauri-plugin-updater = "2"
2828
serialport = "4.2"
29-
sftool-lib = "0.1.18"
29+
sftool-lib = "0.1.19"
3030
tauri-plugin-dialog = "2"
3131
tauri-plugin-fs = "2"
3232
tauri-plugin-process = "2"
3333
reqwest = { version = "0.12", features = ["json", "rustls-tls", "blocking"] }
34+
tempfile = "3.17.1"

src-tauri/capabilities/default.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
"dialog:default",
1414
"fs:default",
1515
"fs:allow-write-text-file",
16+
"fs:allow-read-text-file",
17+
"fs:allow-exists",
18+
"fs:allow-mkdir",
19+
"fs:scope-appdata-recursive",
1620
"process:default",
1721
"core:window:allow-start-dragging",
1822
"core:window:allow-show",

src-tauri/src/commands/device.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,14 @@ pub async fn connect_device(
5454
_interface_type: String,
5555
port: Option<String>,
5656
baud_rate: Option<u32>,
57+
stub_path: String,
5758
) -> Result<bool, String> {
5859
let device_config = DeviceConfig {
5960
chip_type: chip_model,
6061
memory_type,
6162
port_name: port.ok_or("端口名不能为空")?,
6263
baud_rate: baud_rate.ok_or("波特率不能为空")?,
64+
stub_path,
6365
};
6466

6567
// 创建 Tauri 进度回调

src-tauri/src/types/device.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ pub struct DeviceConfig {
1212
pub memory_type: String,
1313
pub port_name: String,
1414
pub baud_rate: u32,
15+
pub stub_path: String,
1516
}

src-tauri/src/types/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ pub mod config;
22
pub mod device;
33
pub mod flash;
44
pub mod progress;
5+
pub mod stub_config_spec;
56

67
pub use config::*;
78
pub use device::*;
89
pub use flash::*;
910
pub use progress::*;
11+
pub use stub_config_spec::*;

0 commit comments

Comments
 (0)