forked from mia/Aegisub
Mark autosave files with the current date and time
This makes it so that autosave files are (almost) never overwritten, so that opening an old version of the file won't result in the autosaves from a newer version being replaced. Clean up old autosave files on startup to limit the total to 100 files/100 MB. Maybe make this configurable in the future? Closes #1155.
This commit is contained in:
parent
820732b97e
commit
56ced22c63
2 changed files with 7 additions and 9 deletions
|
@ -164,10 +164,9 @@ wxString AssFile::AutoSave() {
|
||||||
wxMkdir(path);
|
wxMkdir(path);
|
||||||
|
|
||||||
wxString name = origfile.GetName();
|
wxString name = origfile.GetName();
|
||||||
if (name.empty())
|
if (!name)
|
||||||
dstpath.SetFullName("Untitled.AUTOSAVE.ass");
|
name = "Untitled";
|
||||||
else
|
dstpath.SetFullName(wxString::Format("%s.%s.AUTOSAVE.ass", name, wxDateTime::Now().Format("%Y-%m-%d-%H-%M-%S")));
|
||||||
dstpath.SetFullName(name + ".AUTOSAVE.ass");
|
|
||||||
|
|
||||||
Save(dstpath.GetFullPath(), false, false);
|
Save(dstpath.GetFullPath(), false, false);
|
||||||
|
|
||||||
|
|
|
@ -282,15 +282,14 @@ bool AegisubApp::OnInit() {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
StartupLog("Clean old autosave files");
|
||||||
|
wxString autosave_path = lagi_wxString(OPT_GET("Path/Auto/Save")->GetString());
|
||||||
|
CleanCache(autosave_path, "*.AUTOSAVE.ass", 100, 1000);
|
||||||
|
|
||||||
StartupLog("Initialization complete");
|
StartupLog("Initialization complete");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Exit
|
|
||||||
/// @return
|
|
||||||
///
|
|
||||||
int AegisubApp::OnExit() {
|
int AegisubApp::OnExit() {
|
||||||
if (frame)
|
if (frame)
|
||||||
delete frame;
|
delete frame;
|
||||||
|
|
Loading…
Reference in a new issue