2026-04-13 07:48:27 +00:00
|
|
|
mod db;
|
|
|
|
|
mod error;
|
2026-04-13 07:54:52 +00:00
|
|
|
mod models;
|
2026-04-13 07:48:27 +00:00
|
|
|
|
|
|
|
|
use std::sync::Mutex;
|
|
|
|
|
use tauri::Manager;
|
|
|
|
|
|
|
|
|
|
pub struct AppState {
|
|
|
|
|
pub db: Mutex<rusqlite::Connection>,
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-13 07:31:24 +00:00
|
|
|
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
|
|
|
|
pub fn run() {
|
|
|
|
|
tauri::Builder::default()
|
2026-04-13 07:48:27 +00:00
|
|
|
.setup(|app| {
|
|
|
|
|
let db_dir = app.path().app_data_dir()?;
|
|
|
|
|
std::fs::create_dir_all(&db_dir)?;
|
|
|
|
|
let db_path = db_dir.join("orchai.db");
|
|
|
|
|
let conn = db::init(&db_path).expect("Failed to initialize database");
|
|
|
|
|
app.manage(AppState {
|
|
|
|
|
db: Mutex::new(conn),
|
|
|
|
|
});
|
|
|
|
|
Ok(())
|
|
|
|
|
})
|
2026-04-13 07:31:24 +00:00
|
|
|
.run(tauri::generate_context!())
|
|
|
|
|
.expect("error while running tauri application");
|
|
|
|
|
}
|