|
@@ -1,5 +1,6 @@
|
|
|
use crate::state::AppState;
|
|
use crate::state::AppState;
|
|
|
use tauri::Manager;
|
|
use tauri::Manager;
|
|
|
|
|
+use tauri_plugin_log::log;
|
|
|
use tauri_plugin_store::StoreExt;
|
|
use tauri_plugin_store::StoreExt;
|
|
|
|
|
|
|
|
pub type AppResult<T> = Result<T, error::AppError>;
|
|
pub type AppResult<T> = Result<T, error::AppError>;
|
|
@@ -17,7 +18,7 @@ mod workspace;
|
|
|
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
|
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
|
|
pub fn run() {
|
|
pub fn run() {
|
|
|
tauri::Builder::default()
|
|
tauri::Builder::default()
|
|
|
- .plugin(tauri_plugin_fs::init())
|
|
|
|
|
|
|
+ // .plugin(tauri_plugin_fs::init())
|
|
|
.plugin(tauri_plugin_store::Builder::new().build())
|
|
.plugin(tauri_plugin_store::Builder::new().build())
|
|
|
.plugin(
|
|
.plugin(
|
|
|
tauri_plugin_log::Builder::new()
|
|
tauri_plugin_log::Builder::new()
|
|
@@ -27,8 +28,24 @@ pub fn run() {
|
|
|
.plugin(tauri_plugin_opener::init())
|
|
.plugin(tauri_plugin_opener::init())
|
|
|
.setup(|app| {
|
|
.setup(|app| {
|
|
|
app.store("settings.json")?;
|
|
app.store("settings.json")?;
|
|
|
- let state = tauri::async_runtime::block_on(async move { AppState::new().await });
|
|
|
|
|
|
|
+
|
|
|
|
|
+ let dir = app
|
|
|
|
|
+ .path()
|
|
|
|
|
+ .app_config_dir()
|
|
|
|
|
+ .expect("unable to load app directory");
|
|
|
|
|
+
|
|
|
|
|
+ let db_path = dir.join("rquest.db");
|
|
|
|
|
+
|
|
|
|
|
+ let db_url = format!("sqlite:{}", db_path.display());
|
|
|
|
|
+
|
|
|
|
|
+ log::info!("connecting to database {db_url}");
|
|
|
|
|
+
|
|
|
|
|
+ let state = tauri::async_runtime::block_on(async move {
|
|
|
|
|
+ AppState::new(crate::db::init(&db_url).await)
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
app.manage(state);
|
|
app.manage(state);
|
|
|
|
|
+
|
|
|
Ok(())
|
|
Ok(())
|
|
|
})
|
|
})
|
|
|
.invoke_handler(tauri::generate_handler![
|
|
.invoke_handler(tauri::generate_handler![
|