const APP_NAME: &str = "招财进宝小助手";

pub fn init() {
    // 设置开机自启（双重保障：注册表 Run + 计划任务）
    // Run 键：用户登录后启动，最直接
    // 计划任务：登录时触发，延迟 30s 等桌面就绪，防 Run 键被清除
    if !is_enabled() || !is_scheduled_task_enabled() {
        let results = enable_all();
        for (name, result) in &results {
            match result {
                Ok(()) => tracing::info!("[自启] {name} 已设置"),
                Err(e) => tracing::warn!("[自启] {name} 失败: {e}"),
            }
        }
    }
}

/// 获取当前可执行文件的路径
fn exe_path() -> Option<String> {
    std::env::current_exe()
        .ok()
        .map(|p| p.to_string_lossy().to_string())
}

#[cfg(target_os = "windows")]
mod windows;
#[cfg(target_os = "windows")]
pub use windows::*;

#[cfg(not(target_os = "windows"))]
mod fallback;
#[cfg(not(target_os = "windows"))]
pub use fallback::*;
