fix: build loi E0308 - blocking_pick_folder tra Option<FilePath> khong phai PathBuf
tauri-plugin-dialog v2: blocking_pick_folder() -> Option<FilePath> (enum Path(PathBuf) | Url(Url) — xac minh tu source plugins-workspace v2: plugins/dialog/src/lib.rs:728 + plugins/fs/src/file_path.rs:20). Match FilePath::Path -> to_string_lossy, FilePath::Url -> to_string.
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
// Ngoài ra lib.rs còn dò THÊM các vị trí fallback (legacy/portable/dev)
|
||||
// và ghi đầy đủ diagnostic vào %APPDATA%/SonicForgeDAW/logs/spawn.log.
|
||||
use tauri::Manager;
|
||||
use tauri_plugin_dialog::DialogExt;
|
||||
use tauri_plugin_dialog::{DialogExt, FilePath};
|
||||
use tauri_plugin_shell::process::CommandChild;
|
||||
use tauri_plugin_shell::ShellExt;
|
||||
use std::path::{Path, PathBuf};
|
||||
@@ -184,12 +184,17 @@ pub fn run() {
|
||||
let handle = app_handle.clone();
|
||||
let resp_for_main = resp.clone();
|
||||
let _ = handle.run_on_main_thread(move || {
|
||||
let picked: Option<PathBuf> = handle
|
||||
// tauri-plugin-dialog v2: blocking_pick_folder() tra
|
||||
// Option<FilePath> (enum Path(PathBuf) | Url(Url))
|
||||
let picked: Option<FilePath> = handle
|
||||
.dialog()
|
||||
.file()
|
||||
.blocking_pick_folder();
|
||||
let val = picked
|
||||
.map(|p| p.to_string_lossy().to_string())
|
||||
.map(|p| match p {
|
||||
FilePath::Path(pb) => pb.to_string_lossy().to_string(),
|
||||
FilePath::Url(u) => u.to_string(),
|
||||
})
|
||||
.unwrap_or_default();
|
||||
let _ = std::fs::write(&resp_for_main, val);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user