win-rar 0.1.0

A Windows archive manager supporting ZIP, 7z, RAR, TAR with encryption, shell integration, and drag-and-drop
// 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()
}