From 47cceb5a7821b03cae1002c6fc053365ec596598 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Thu, 17 Oct 2002 20:52:32 +0000 Subject: [PATCH] Rename .sm files on save, too. Add explanation and a TODO. --- stepmania/src/Song.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index 6ddac986b1..a23f1f3d71 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -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