feat: initialise commit

This commit is contained in:
zihluwang committed 2025-07-26 00:38:46 +08:00
commit 84455906c9
47 files changed
+11991

No files matched your search

+10
View File
@@ -0,0 +1,10 @@
#[tauri::command]
pub fn greet(name: &str) -> String {
format!("Hello, {}! You've been greeted from Rust!", name)
}
#[tauri::command]
pub fn get_message(level: &str) -> String {
println!("level = {level}");
"".to_string()
}
+1
View File
@@ -0,0 +1 @@
pub const APP_NAME: &str = "ZuAnBot";
+16
View File
@@ -0,0 +1,16 @@
use anyhow::Result;
use std::path::PathBuf;
/// Get system-wide data dir.
pub fn get_global_data_dir() -> Result<PathBuf> {
#[cfg(target_os = "macos")]
let global_data_dir = PathBuf::from("/Library/Application Support/");
#[cfg(target_os = "windows")]
let global_data_dir = PathBuf::from("C:\\ProgramData\\");
#[cfg(target_os = "linux")]
let global_data_dir = PathBuf::from("/var/lib/");
Ok(global_data_dir)
}
+14
View File
@@ -0,0 +1,14 @@
use crate::commands::{greet, get_message};
mod commands;
mod dirs;
mod constants;
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
tauri::Builder::default()
.plugin(tauri_plugin_opener::init())
.invoke_handler(tauri::generate_handler![greet, get_message])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
+6
View File
@@ -0,0 +1,6 @@
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
fn main() {
zuanbot_lib::run()
}