mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-08-17 23:55:04 +00:00
Fix for file overwrite
This commit is contained in:
parent
884a008333
commit
c5a8c99597
@ -150,6 +150,10 @@ bool save_to_file(const PropertiesFile* file) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// rename() may not overwrite an existing destination on some filesystems (e.g. FAT on
|
||||||
|
// ESP32), so remove it first; this is best-effort and ignored if the path doesn't exist yet.
|
||||||
|
std::remove(file->path.c_str());
|
||||||
|
|
||||||
if (std::rename(temp_path.c_str(), file->path.c_str()) != 0) {
|
if (std::rename(temp_path.c_str(), file->path.c_str()) != 0) {
|
||||||
LOG_E(TAG, "Failed to replace %s", file->path.c_str());
|
LOG_E(TAG, "Failed to replace %s", file->path.c_str());
|
||||||
std::remove(temp_path.c_str());
|
std::remove(temp_path.c_str());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user