44 lines
1.2 KiB
Rust
44 lines
1.2 KiB
Rust
|
|
mod commands;
|
||
|
|
mod state;
|
||
|
|
|
||
|
|
use std::sync::Mutex;
|
||
|
|
|
||
|
|
use tauri::Manager;
|
||
|
|
|
||
|
|
use state::AppState;
|
||
|
|
|
||
|
|
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||
|
|
pub fn run() {
|
||
|
|
tauri::Builder::default()
|
||
|
|
.plugin(tauri_plugin_dialog::init())
|
||
|
|
.setup(|app| {
|
||
|
|
let data_dir = app
|
||
|
|
.path()
|
||
|
|
.app_data_dir()
|
||
|
|
.expect("resolve app data dir");
|
||
|
|
std::fs::create_dir_all(&data_dir).ok();
|
||
|
|
app.manage(Mutex::new(AppState::new(data_dir)));
|
||
|
|
Ok(())
|
||
|
|
})
|
||
|
|
.invoke_handler(tauri::generate_handler![
|
||
|
|
commands::get_status,
|
||
|
|
commands::set_library_path,
|
||
|
|
commands::update_card_data,
|
||
|
|
commands::search_cards,
|
||
|
|
commands::add_owned,
|
||
|
|
commands::set_owned,
|
||
|
|
commands::set_location,
|
||
|
|
commands::search_library,
|
||
|
|
commands::list_decks,
|
||
|
|
commands::create_deck,
|
||
|
|
commands::delete_deck,
|
||
|
|
commands::set_deck_format,
|
||
|
|
commands::set_deck_commander,
|
||
|
|
commands::set_deck_card,
|
||
|
|
commands::deck_contents,
|
||
|
|
commands::card_decks,
|
||
|
|
])
|
||
|
|
.run(tauri::generate_context!())
|
||
|
|
.expect("error while running tauri application");
|
||
|
|
}
|