建立前端与 Tauri 桌面端的首个版本提交,包含核心编辑器、项目文件读写、测试与构建配置。 补充 Git 忽略规则和换行规范,排除依赖、构建产物、本地运行日志与临时验证文件,方便在其他电脑继续开发。
20 lines
584 B
Rust
20 lines
584 B
Rust
use std::path::PathBuf;
|
|
|
|
use tauri_plugin_fs::FsExt;
|
|
|
|
#[tauri::command]
|
|
fn allow_project_directory(app: tauri::AppHandle, path: String) -> Result<(), String> {
|
|
app.fs_scope()
|
|
.allow_directory(PathBuf::from(path), true)
|
|
.map_err(|error| error.to_string())
|
|
}
|
|
|
|
fn main() {
|
|
tauri::Builder::default()
|
|
.plugin(tauri_plugin_dialog::init())
|
|
.plugin(tauri_plugin_fs::init())
|
|
.invoke_handler(tauri::generate_handler![allow_project_directory])
|
|
.run(tauri::generate_context!())
|
|
.expect("error while running BlockFlow Workbench");
|
|
}
|