Initialize Tauri project for rust_media_viewer_v2
This commit is contained in:
1 parent
65b4b27957
commit
a1af08aa00
38 files changed
+7537
No files matched your search
@@ -0,0 +1,23 @@
|
||||
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");
|
||||
}
|
||||
Reference in new issue
Block a user