refactor: replace fs2 crate with stabilised std::fs equivalents

This commit is contained in:
nekename committed 2026-02-19 18:07:12 +00:00
1 parent f3aaa1b567
commit 612dc3a3b0
3 files changed
+4 -17

No files matched your search

-11
View File
@@ -1506,16 +1506,6 @@ dependencies = [
"pkg-config",
]
[[package]]
name = "fs2"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213"
dependencies = [
"libc",
"winapi",
]
[[package]]
name = "fs_extra"
version = "1.3.0"
@@ -3244,7 +3234,6 @@ dependencies = [
"elgato-streamdeck",
"fix-path-env",
"font-loader",
"fs2",
"futures",
"hidapi",
"image",
-1
View File
@@ -29,7 +29,6 @@ futures = "0.3"
anyhow = "1.0"
log = "0.4"
log-panics = "2.1"
fs2 = "0.4"
open = "5.3"
tauri-plugin-log = "2.8"
tauri-plugin-cors-fetch = "4.2"
+4 -5
View File
@@ -7,7 +7,6 @@ use std::fs;
use std::io::Write;
use std::path::{Path, PathBuf};
use fs2::FileExt;
use serde::{Deserialize, Serialize};
pub trait FromAndIntoDiskValue
@@ -84,11 +83,11 @@ where
let backup_path = self.path.with_extension("json.bak");
// Write to temporary file
let mut temp_file = fs::OpenOptions::new().write(true).create(true).truncate(true).open(&temp_path)?;
FileExt::lock_exclusive(&temp_file)?;
let mut temp_file = fs::OpenOptions::new().write(true).truncate(true).create(true).open(&temp_path)?;
temp_file.lock()?;
temp_file.write_all(contents.as_bytes())?;
temp_file.sync_all()?;
FileExt::unlock(&temp_file)?;
temp_file.sync_data()?;
temp_file.unlock()?;
drop(temp_file);
// If main file exists, back it up