Revert "feat(settings): add auto-launch on system startup feature"

This reverts commit ba336fc416.

Reason: Found issues that need to be addressed before reintroducing
the auto-launch feature. Will reimplement with fixes.
This commit is contained in:
Jason
2025-11-21 23:30:56 +08:00
parent ba336fc416
commit eb46ac8592
14 changed files with 0 additions and 178 deletions

View File

@@ -1,39 +0,0 @@
use crate::error::AppError;
use auto_launch::AutoLaunch;
/// 初始化 AutoLaunch 实例
fn get_auto_launch() -> Result<AutoLaunch, AppError> {
let app_name = "CC Switch";
let app_path = std::env::current_exe().map_err(AppError::AutoLaunchPathError)?;
let auto_launch = AutoLaunch::new(app_name, &app_path.to_string_lossy(), false, &[] as &[&str]);
Ok(auto_launch)
}
/// 启用开机自启
pub fn enable_auto_launch() -> Result<(), AppError> {
let auto_launch = get_auto_launch()?;
auto_launch
.enable()
.map_err(|e| AppError::AutoLaunchEnableError(e.to_string()))?;
log::info!("Auto-launch enabled");
Ok(())
}
/// 禁用开机自启
pub fn disable_auto_launch() -> Result<(), AppError> {
let auto_launch = get_auto_launch()?;
auto_launch
.disable()
.map_err(|e| AppError::AutoLaunchDisableError(e.to_string()))?;
log::info!("Auto-launch disabled");
Ok(())
}
/// 检查是否已启用开机自启
pub fn is_auto_launch_enabled() -> Result<bool, AppError> {
let auto_launch = get_auto_launch()?;
auto_launch
.is_enabled()
.map_err(|e| AppError::AutoLaunchCheckError(e.to_string()))
}