wutil: libc::unlink -> std::fs::remove_file

Part of #12380
This commit is contained in:
Daniel Rainer
2026-01-25 16:27:15 +01:00
committed by Johannes Altmanninger
parent 43513d3fca
commit 44f9363e39
3 changed files with 5 additions and 5 deletions

View File

@@ -478,7 +478,7 @@ fn try_rewriting<F, UserData>(
.as_ref()
.is_ok_and(|(_file_id, potential_update)| !potential_update.do_save)
{
wunlink(&tmp_name);
let _ = wunlink(&tmp_name);
}
result
}

View File

@@ -831,7 +831,7 @@ fn clear(&mut self) {
self.first_unwritten_new_item_index = 0;
self.file_contents = None;
if let Ok(Some(filename)) = self.history_file_path() {
wunlink(&filename);
let _ = wunlink(&filename);
}
self.clear_file_state();
}

View File

@@ -59,9 +59,9 @@ pub fn waccess(file_name: &wstr, mode: libc::c_int) -> libc::c_int {
}
/// Wide character version of unlink().
pub fn wunlink(file_name: &wstr) -> libc::c_int {
let tmp = wcs2zstring(file_name);
unsafe { libc::unlink(tmp.as_ptr()) }
pub fn wunlink(file_name: &wstr) -> io::Result<()> {
let tmp = wcs2osstring(file_name);
fs::remove_file(tmp)
}
pub fn wperror(s: &wstr) {