23 lines
680 B
Rust
23 lines
680 B
Rust
mod media;
|
|||
|
|
|
||
|
|
use media::{list_files, FileInfo};
|
||
|
|
|
||
|
|
#[tauri::command]
|
||
|
|
async fn list_files_command(dir_path: String) -> Result<Vec<FileInfo>, String> {
|
||
|
|
list_files(&dir_path).map_err(|e| e.to_string())
|
||
|
|
}
|
||
|
|
|
||
|
|
#[tauri::command]
|
||
|
|
fn greet(name: &str) -> String {
|
||
|
|
format!("Hello, {}! You've been greeted from Rust!", name)
|
||
|
|
}
|
||
|
|
|
||
|
|
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||
|
|
pub fn run() {
|
||
|
|
tauri::Builder::default()
|
||
|
|
.plugin(tauri_plugin_opener::init())
|
||
|
|
.plugin(tauri_plugin_dialog::init())
|
||
|
|
.invoke_handler(tauri::generate_handler![greet, list_files_command])
|
||
|
|
.run(tauri::generate_context!())
|
||
|
|
.expect("error while running tauri application");
|
||
|
|
}
|