mirror of
https://github.com/FEX-Emu/FEX.git
synced 2024-12-15 01:49:00 +00:00
Telemetry: Rename old file instead of copying
Since we do an immediate overwrite of the file we are copying, we can instead do a rename. Failure on rename is fine, will either mean the telemetry file didn't exist initially, or some other permission error so the telemetry will get lost regardless.
This commit is contained in:
parent
8852d94416
commit
4952b2e16c
@ -61,11 +61,11 @@ namespace FEXCore::Telemetry {
|
||||
auto DataDirectory = Config::GetDataDirectory();
|
||||
DataDirectory += "Telemetry/" + ApplicationName + ".telem";
|
||||
|
||||
if (FHU::Filesystem::Exists(DataDirectory)) {
|
||||
// If the file exists, retain a single backup
|
||||
auto Backup = DataDirectory + ".1";
|
||||
FHU::Filesystem::CopyFile(DataDirectory, Backup, FHU::Filesystem::CopyOptions::OVERWRITE_EXISTING);
|
||||
}
|
||||
// Retain a single backup if the telemetry already existed.
|
||||
auto Backup = DataDirectory + ".bck";
|
||||
|
||||
// Failure on rename is okay.
|
||||
(void)FHU::Filesystem::RenameFile(DataDirectory, Backup);
|
||||
|
||||
auto File = FEXCore::File::File(DataDirectory.c_str(),
|
||||
FEXCore::File::FileModes::WRITE |
|
||||
|
Loading…
Reference in New Issue
Block a user