50 lines
1.5 KiB
Rust
50 lines
1.5 KiB
Rust
mod config;
|
|
mod database;
|
|
mod file_access;
|
|
mod file_handler;
|
|
mod file_tree;
|
|
mod markdown_parser;
|
|
mod search;
|
|
|
|
use config::{get_basepath, load_config, set_basepath, Config};
|
|
use database::initialize_database;
|
|
use file_handler::{load_file, save_file};
|
|
use file_tree::dir_tree_html;
|
|
use markdown_parser::parse_markdown;
|
|
use search::search_files;
|
|
use std::env;
|
|
use std::sync::Mutex;
|
|
use tauri::Manager;
|
|
use tauri_plugin_fs::FsExt;
|
|
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
|
pub fn run() {
|
|
tauri::Builder::default()
|
|
.plugin(tauri_plugin_dialog::init())
|
|
.plugin(tauri_plugin_fs::init())
|
|
.plugin(tauri_plugin_log::Builder::new().build())
|
|
.plugin(tauri_plugin_shell::init())
|
|
.plugin(tauri_plugin_log::Builder::new().build())
|
|
.setup(|app| {
|
|
// allowed the given directory
|
|
let scope = app.fs_scope();
|
|
scope.allow_directory(tauri::path::BaseDirectory::Home.variable(), true);
|
|
app.set_theme(Some(tauri::Theme::Dark));
|
|
|
|
let config = load_config(None);
|
|
app.manage(Mutex::new(config)); //RWLock
|
|
|
|
Ok(())
|
|
})
|
|
.invoke_handler(tauri::generate_handler![
|
|
initialize_database,
|
|
dir_tree_html,
|
|
parse_markdown,
|
|
search_files,
|
|
get_basepath,
|
|
set_basepath,
|
|
load_file,
|
|
save_file
|
|
])
|
|
.run(tauri::generate_context!())
|
|
.expect("error while running tauri application");
|
|
}
|