feat: TOML-Config und Datenordner anlegen

config.toml im App-Konfigurationsordner, Standard wird beim ersten Start
angelegt. Datenordner und Aufgabenordner werden aufgelöst und im Setup
angezeigt. Standard-Startseite ersetzt durch Pfad-Ansicht.
cargo test: 6 Tests grün. Klicktests start2app.1-.2 noch manuell offen.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-06 18:49:29 +01:00
parent 57fbc57a54
commit 3bd5197867
6 changed files with 233 additions and 143 deletions

View File

@ -1,14 +1,34 @@
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
mod config;
use config::Paths;
use tauri::{Manager, State};
/// Aufgelöste Pfade, einmal beim Start ermittelt.
pub struct AppPaths(pub Paths);
#[tauri::command]
fn greet(name: &str) -> String {
format!("Hello, {}! You've been greeted from Rust!", name)
fn get_paths(paths: State<'_, AppPaths>) -> Paths {
paths.0.clone()
}
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
tauri::Builder::default()
.plugin(tauri_plugin_opener::init())
.invoke_handler(tauri::generate_handler![greet])
.setup(|app| {
let config_dir = app
.path()
.app_config_dir()
.map_err(|e| format!("Konfigurationsordner nicht ermittelbar: {e}"))?;
let default_data_dir = app
.path()
.app_data_dir()
.map_err(|e| format!("Datenordner nicht ermittelbar: {e}"))?;
let paths = config::load_or_create(&config_dir, &default_data_dir)?;
app.manage(AppPaths(paths));
Ok(())
})
.invoke_handler(tauri::generate_handler![get_paths])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}