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);
|
||||
|
||||
wxString name = origfile.GetName();
|
||||
if (name.empty())
|
||||
dstpath.SetFullName("Untitled.AUTOSAVE.ass");
|
||||
else
|
||||
dstpath.SetFullName(name + ".AUTOSAVE.ass");
|
||||
if (!name)
|
||||
name = "Untitled";
|
||||
dstpath.SetFullName(wxString::Format("%s.%s.AUTOSAVE.ass", name, wxDateTime::Now().Format("%Y-%m-%d-%H-%M-%S")));
|
||||
|
||||
Save(dstpath.GetFullPath(), false, false);
|
||||
|
||||
|
|
|
@ -282,15 +282,14 @@ bool AegisubApp::OnInit() {
|
|||
}
|
||||
#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");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// @brief Exit
|
||||
/// @return
|
||||
///
|
||||
int AegisubApp::OnExit() {
|
||||
if (frame)
|
||||
delete frame;
|
||||
|
|
Loading…
Reference in a new issue