1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
// Copyright (c) 北京锋通科技有限公司 — 郭玉峰、吴琼 // SPDX-License-Identifier: MIT use crate::shell; /// 注册 Windows 壳集成(右键菜单 + 文件关联) #[tauri::command] pub fn register_shell() -> Result<String, String> { let exe_path = std::env::current_exe() .map(|p| p.to_string_lossy().to_string()) .map_err(|e| format!("获取 exe 路径失败: {}", e))?; shell::register_shell_integration(&exe_path)?; Ok("壳集成注册成功".to_string()) } /// 注销 Windows 壳集成 #[tauri::command] pub fn unregister_shell() -> Result<String, String> { shell::unregister_shell_integration()?; Ok("壳集成注销成功".to_string()) } /// 检查壳集成状态 #[tauri::command] pub fn check_shell_integration() -> bool { shell::is_shell_integrated() }