From 0e946835b6f36c161e38063a3fdb2722dcc9d88f Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Thu, 29 Dec 2005 01:22:23 +0000 Subject: [PATCH] filter filenames, so creating an edit named "foo 2/3" doesn't fail when writing --- stepmania/src/NotesWriterSM.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/stepmania/src/NotesWriterSM.cpp b/stepmania/src/NotesWriterSM.cpp index d90401e41d..48a0d20f4d 100644 --- a/stepmania/src/NotesWriterSM.cpp +++ b/stepmania/src/NotesWriterSM.cpp @@ -257,8 +257,19 @@ void NotesWriterSM::GetEditFileContents( const Song *pSong, const Steps *pSteps, CString NotesWriterSM::GetEditFileName( const Song *pSong, const Steps *pSteps ) { - // guaranteed to be a unique name - return pSong->GetTranslitFullTitle() + " - " + pSteps->GetDescription() + ".edit"; + /* Try to make a unique name. This isn't guaranteed. Edit descriptions are + * case-sensitive, filenames on disk are usually not, and we decimate certain + * characters for FAT filesystems. */ + CString sFile = pSong->GetTranslitFullTitle() + " - " + pSteps->GetDescription(); + + // HACK: + if( pSteps->m_StepsType == STEPS_TYPE_DANCE_DOUBLE ) + sFile += " (doubles)"; + + sFile += ".edit"; + + MakeValidFilename( sFile ); + return sFile; } bool NotesWriterSM::WriteEditFileToMachine( const Song *pSong, Steps *pSteps )