chore: remove duplicate localservice preflight defs
This commit is contained in:
parent
484eb8fbe9
commit
dd57bc9886
1 changed files with 0 additions and 35 deletions
|
|
@ -665,41 +665,6 @@ fn ensure_localservice_writable_preflight() -> Result<(), String> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn can_write_dir(dir: &Path) -> bool {
|
|
||||||
if fs::create_dir_all(dir).is_err() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
let probe = dir.join(".raven_acl_probe");
|
|
||||||
match OpenOptions::new()
|
|
||||||
.create(true)
|
|
||||||
.write(true)
|
|
||||||
.truncate(true)
|
|
||||||
.open(&probe)
|
|
||||||
{
|
|
||||||
Ok(mut file) => {
|
|
||||||
let result = file.write_all(b"ok").is_ok();
|
|
||||||
let _ = fs::remove_file(&probe);
|
|
||||||
result
|
|
||||||
}
|
|
||||||
Err(_) => false,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn ensure_localservice_writable_preflight() -> Result<(), String> {
|
|
||||||
let dir = PathBuf::from(LOCAL_SERVICE_CONFIG);
|
|
||||||
if can_write_dir(&dir) {
|
|
||||||
return Ok(());
|
|
||||||
}
|
|
||||||
log_event("Tentando corrigir ACL do perfil LocalService via UAC (preflight)...");
|
|
||||||
fix_localservice_acl()?;
|
|
||||||
if can_write_dir(&dir) {
|
|
||||||
log_event("ACL do LocalService ajustada com sucesso.");
|
|
||||||
Ok(())
|
|
||||||
} else {
|
|
||||||
Err("continua sem permissão para LocalService (após preflight)".into())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn can_write_dir(dir: &Path) -> bool {
|
fn can_write_dir(dir: &Path) -> bool {
|
||||||
if fs::create_dir_all(dir).is_err() {
|
if fs::create_dir_all(dir).is_err() {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue