fix(windows): repair a data root owned by another account

This commit is contained in:
wonfen
2026-08-30 11:45:04 +08:00
parent 1b76b222fb
commit 632c5b2bc5
3 changed files with 254 additions and 6 deletions
+10
View File
@@ -242,6 +242,16 @@ pub fn run() -> std::process::ExitCode {
let _ = utils::dirs::init_portable_flag();
// Runs before the singleton check, which is the first thing to open a file in that directory.
#[cfg(windows)]
if let Err(error) =
utils::dirs::preinit_app_data_dir().and_then(|root| core::owner_identity::repair_app_data_root_owner(&root))
{
// The logger is installed later in setup(), so this would otherwise be lost.
eprintln!("[clash-verge] 应用数据目录所有权修复失败: {error:#}");
logging!(error, Type::Setup, "应用数据目录所有权修复失败: {error:#}");
}
match handle_singleton_startup(app_init::init_singleton_check(), utils::startup::report_error) {
StartupAction::Continue => {}
StartupAction::ExitSuccess => return std::process::ExitCode::SUCCESS,