Rename .sm files on save, too. Add explanation and a TODO.

This commit is contained in:
Glenn Maynard
2002-10-17 20:52:32 +00:00
parent 1e6a9d3bc3
commit 47cceb5a78
+10 -3
View File
@@ -648,13 +648,20 @@ void Song::Save()
{
LOG->Trace( "Song::SaveToSongFile()" );
//
// rename all old files to avoid confusion
//
/* rename all old files to avoid confusion.
*
* This also serves as a backup, so rename .sm's, too. If we crash when
* saving the .sm, we don't want to lose what we had. But, what we really
* should be doing is saving to another file (eg. foo.sm.new), then once we
* know we havn't crashed, move the old .sm to .sm.old and the new one to
* the real filename. That way, if we crash, we don't leave the song in an
* unplayable state where the user has to manually un-rename stuff. XXX -glenn
*/
CStringArray arrayOldFileNames;
GetDirListing( m_sSongDir + "*.bms", arrayOldFileNames );
GetDirListing( m_sSongDir + "*.dwi", arrayOldFileNames );
GetDirListing( m_sSongDir + "*.ksf", arrayOldFileNames );
GetDirListing( m_sSongDir + "*.sm", arrayOldFileNames );
for( int i=0; i<arrayOldFileNames.GetSize(); i++ )
{