fix: 修复跨平台编译错误 - 添加 macOS 存根方法

- 添加 set_macos_machine_id 的非 macOS 平台存根实现
- 添加 check_macos_admin 的非 macOS 平台存根实现
- 修复 E0599 编译错误:方法未找到
- 所有平台现在都能正确编译
- 遵循现有的条件编译模式
This commit is contained in:
coso
2025-12-26 01:56:49 +08:00
parent 6a6c538b03
commit 369424caef
@@ -491,6 +491,29 @@ impl MachineIdService {
})
}
// === macOS 存根实现 (非 macOS 平台) ===
#[cfg(not(target_os = "macos"))]
async fn set_macos_machine_id(&self, _new_id: &str) -> Result<MachineIdResult, String> {
Ok(MachineIdResult {
success: false,
message: "macOS machine ID modification not supported on this platform".to_string(),
requires_restart: false,
requires_admin: false,
new_machine_id: None,
})
}
#[cfg(not(target_os = "macos"))]
async fn check_macos_admin(&self) -> Result<AdminStatus, String> {
Ok(AdminStatus {
is_admin: false,
platform: "non-macOS".to_string(),
elevation_method: None,
check_success: false,
})
}
// === Linux 特定实现 ===
#[cfg(target_os = "linux")]