Add text fixes

This commit is contained in:
darktohka
2026-03-17 03:10:47 +02:00
parent adc456b8f6
commit 202e2c160f
16 changed files with 143 additions and 140 deletions
+20 -12
View File
@@ -23,17 +23,20 @@ pub fn delete_file(path: &Path) {
}
// Retry loop with ownership acquisition.
for _ in 0..10 {
if try_take_ownership_and_delete(path) {
return;
#[cfg(windows)]
{
for _ in 0..10 {
if try_take_ownership_and_delete(path) {
return;
}
thread::sleep(Duration::from_millis(500));
}
thread::sleep(Duration::from_millis(500));
}
// Last resort: kill any processes using the file, then delete.
kill_locking_processes(path);
thread::sleep(Duration::from_millis(500));
let _ = fs::remove_file(path);
// Last resort: kill any processes using the file, then delete.
kill_locking_processes(path);
thread::sleep(Duration::from_millis(500));
let _ = fs::remove_file(path);
}
}
/// Recursively delete all files (optionally matching `filename`) under `base_dir`.
@@ -84,9 +87,12 @@ pub fn wipe_folder(path: &Path) {
// If folder is now empty, remove it.
if is_dir_empty(path) {
if fs::remove_dir(path).is_err() {
kill_locking_processes(path);
thread::sleep(Duration::from_millis(500));
let _ = fs::remove_dir(path);
#[cfg(windows)]
{
kill_locking_processes(path);
thread::sleep(Duration::from_millis(500));
let _ = fs::remove_dir(path);
}
}
}
}
@@ -101,6 +107,7 @@ fn try_clear_readonly_and_delete(path: &Path) -> bool {
fs::remove_file(path).is_ok()
}
#[cfg(windows)]
fn try_take_ownership_and_delete(path: &Path) -> bool {
use windows_sys::Win32::Foundation::{CloseHandle, LocalFree};
use windows_sys::Win32::Security::{
@@ -191,6 +198,7 @@ fn try_take_ownership_and_delete(path: &Path) -> bool {
try_clear_readonly_and_delete(path)
}
#[cfg(windows)]
fn kill_locking_processes(path: &Path) {
use windows_sys::Win32::Foundation::CloseHandle;
use windows_sys::Win32::System::RestartManager::{
@@ -13,7 +13,7 @@ pub fn run_process(program: &str, args: &[&str]) -> ExitedProcess {
.stdout(Stdio::piped())
.stderr(Stdio::piped());
#[cfg(target_os = "windows")]
#[cfg(windows)]
cmd.creation_flags(CREATE_NO_WINDOW);
let result = cmd.output();
@@ -42,7 +42,7 @@ pub fn run_unmanaged_process(program: &str, args: &[&str]) {
.stdout(Stdio::null())
.stderr(Stdio::null());
#[cfg(target_os = "windows")]
#[cfg(windows)]
cmd.creation_flags(CREATE_NO_WINDOW);
let _ = cmd.status();
@@ -109,6 +109,7 @@ impl SystemInfo {
result
}
#[cfg(windows)]
pub fn is_legacy_windows(&self) -> bool {
// Windows version < 6.2 (before Windows 8).
unsafe {
@@ -123,14 +124,21 @@ impl SystemInfo {
|| (info.dwMajorVersion == 6 && info.dwMinorVersion < 2)
}
}
#[cfg(not(windows))]
pub fn is_legacy_windows(&self) -> bool {
false
}
}
#[cfg(windows)]
extern "system" {
fn RtlGetVersion(
lp_version_information: *mut windows_sys::Win32::System::SystemInformation::OSVERSIONINFOW,
) -> i32;
}
#[cfg(windows)]
unsafe fn rtl_get_version(
info: &mut windows_sys::Win32::System::SystemInformation::OSVERSIONINFOW,
) {
@@ -307,6 +307,7 @@ pub fn uninstall(form: &dyn ProgressCallback) -> Result<(), InstallError> {
form.update_progress_label("Stopping Flash auto-updater task...", true);
delete_task("Adobe Flash Player Updater");
delete_task("Adobe Flash Player Updater");
form.update_progress_label("Stopping Flash auto-updater service...", true);
delete_service("AdobeFlashPlayerUpdateSvc");