correct setup

This commit is contained in:
Jamie
2021-12-27 16:41:17 -08:00
parent e29f7eaafb
commit 1d09081f71
4 changed files with 21 additions and 22 deletions

View File

@@ -69,11 +69,11 @@ pub async fn test_scan() -> Result<(), String> {
// Ok(thumbnail_b64)
// }
#[tauri::command(async)]
pub async fn get_thumbs_for_directory(window: tauri::Window, path: &str) -> Result<(), String> {
let config = CONFIG.get().unwrap();
// #[tauri::command(async)]
// pub async fn get_thumbs_for_directory(window: tauri::Window, path: &str) -> Result<(), String> {
// let config = CONFIG.get().unwrap();
let thumbnails = retrieve::get_thumbs_for_directory(path, &config).await?;
// let thumbnails = retrieve::get_thumbs_for_directory(path, &config).await?;
// ....
}
// // ....
// }

View File

@@ -1,16 +1,15 @@
mod commands;
mod menu;
use futures::executor::block_on;
use sdcorelib;
use tauri::api::path;
fn main() {
let data_dir = path::data_dir().unwrap_or(std::path::PathBuf::from("./"));
block_on(sdcorelib::configure(data_dir));
tauri::Builder::default()
.setup(|_app| {
let data_dir = path::data_dir().unwrap_or(std::path::PathBuf::from("./"));
sdcorelib::configure(data_dir);
Ok(())
})
.setup(|_app| Ok(()))
.on_menu_event(|event| menu::handle_menu_event(event))
.invoke_handler(tauri::generate_handler![
commands::scan_dir,

View File

@@ -1,5 +1,5 @@
pub mod checksum;
pub mod icon;
// pub mod icon;
pub mod indexer;
pub mod init;
pub mod retrieve;

View File

@@ -41,15 +41,15 @@ pub async fn configure(mut data_dir: std::path::PathBuf) {
println!("Spacedrive daemon online");
}
pub static MAIN_WINDOW: OnceCell<tauri::window> = OnceCell::new();
// handler to pass "callback" to OneCell intercepting the commands
pub fn emit(kind: &str, data: &str) {
let _message = MAIN_WINDOW
.get()
.unwrap()
.emit(kind, data)
.map_err(|e| println!("{}", e));
}
// pub static MAIN_WINDOW: OnceCell<> = OnceCell::new();
// // handler to pass "callback" to OneCell intercepting the commands
// pub fn emit(kind: &str, data: &str) {
// let _message = MAIN_WINDOW
// .get()
// .unwrap()
// .emit(kind, data)
// .map_err(|e| println!("{}", e));
// }
fn main() {
// hello!