Skip to content

Commit 871f980

Browse files
committed
Backdate the .xbkp file on clean exist (#6955)
1 parent 08925ac commit 871f980

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

README.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ XLIGHTS/NUTCRACKER RELEASE NOTES
1313
2026.16 August ??, 2026
1414

1515
-bug (derwin12) Fix Text effect rendering nondeterministically (and occasionally crashing)
16+
-bug (derwin12) Don't re-prompt to use the rgbeffects autosave backup after the user already chose to discard those changes on exit
1617
-bug (dkulp) FPP Connect: uploading UDP outputs no longer resets FPP10's E1.31 Pacing
1718
and Sending mode - every setting on the universes output that xLights
1819
does not own is now carried forward unchanged

src-ui-wx/xLightsMain.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4100,6 +4100,20 @@ void xLightsFrame::CheckUnsavedChanges()
41004100
if (wxYES == wxMessageBox("Save Models, Views, and Perspectives changes?",
41014101
"Models, Views, and Perspectives Changes Confirmation", wxICON_QUESTION | wxYES_NO | wxNO_DEFAULT, this)) {
41024102
SaveEffectsFile();
4103+
} else {
4104+
// Changes were explicitly discarded ... backdate the autosave backup (if
4105+
// any) below the real file's mtime so LoadEffectsFile() doesn't re-offer
4106+
// the same discarded changes as a "newer autosave found" prompt next open.
4107+
wxFileName fn(CurrentDir, XLIGHTS_RGBEFFECTS_FILE);
4108+
wxFileName bkp(CurrentDir, XLIGHTS_RGBEFFECTS_FILE_BACKUP);
4109+
if (FileExists(fn) && FileExists(bkp)) {
4110+
wxDateTime xmltime = fn.GetModificationTime();
4111+
wxDateTime xbkptime = bkp.GetModificationTime();
4112+
if (xmltime.IsValid() && xbkptime.IsValid() && xbkptime > xmltime) {
4113+
xmltime -= wxTimeSpan(0, 0, 3, 0); // FAT time resolution is 2 seconds
4114+
bkp.SetTimes(&xmltime, &xmltime, &xmltime);
4115+
}
4116+
}
41034117
}
41044118
}
41054119

0 commit comments

Comments
 (0)