diff --git a/stepmania/src/CourseLoaderCRS.cpp b/stepmania/src/CourseLoaderCRS.cpp index 2f68826acf..9a782d128c 100644 --- a/stepmania/src/CourseLoaderCRS.cpp +++ b/stepmania/src/CourseLoaderCRS.cpp @@ -12,7 +12,6 @@ #include "BannerCache.h" #include "RageFileManager.h" #include "CourseWriterCRS.h" -#include "song.h" const int MAX_EDIT_COURSE_SIZE_BYTES = 30*1024; // 30KB @@ -175,7 +174,19 @@ bool CourseLoaderCRS::LoadFromMsd( const RString &sPath, const MsdFile &msd, Cou else { RString sSong = sParams[1]; - new_entry.pSong = SONGMAN->FindSong( sSong ); + sSong.Replace( "\\", "/" ); + vector bits; + split( sSong, "/", bits ); + + if( bits.size() == 2 ) + { + new_entry.sSongGroup = bits[0]; + new_entry.pSong = SONGMAN->FindSong( bits[0], bits[1] ); + } + else if( bits.size() == 1 ) + { + new_entry.pSong = SONGMAN->FindSong( "", sSong ); + } if( new_entry.pSong == NULL ) { @@ -186,7 +197,6 @@ bool CourseLoaderCRS::LoadFromMsd( const RString &sPath, const MsdFile &msd, Cou sPath.c_str(), sSong.c_str()); continue; // skip this #SONG } - new_entry.sSongGroup = new_entry.pSong->m_sGroupName; } new_entry.baseDifficulty = StringToDifficulty( sParams[2] ); diff --git a/stepmania/src/CourseWriterCRS.cpp b/stepmania/src/CourseWriterCRS.cpp index b07b354953..6ff45f2af8 100644 --- a/stepmania/src/CourseWriterCRS.cpp +++ b/stepmania/src/CourseWriterCRS.cpp @@ -102,14 +102,12 @@ bool CourseWriterCRS::Write( const Course &course, RageFileBasic &f, bool bSavin } else if( entry.pSong ) { - // strip off everything but the group name and song dir - vector as; - ASSERT( entry.pSong != NULL ); - split( entry.pSong->GetSongDir(), "/", as ); - ASSERT( as.size() >= 2 ); - RString sGroup = as[ as.size()-2 ]; - RString sSong = as[ as.size()-1 ]; - f.Write( "#SONG:" + sGroup + '/' + sSong ); + const RString &sSong = Basename( entry.pSong->GetSongDir() ); + + f.Write( "#SONG:" ); + if( !entry.sSongGroup.empty() ) + f.Write( entry.sSongGroup + '/' ); + f.Write( sSong ); } else if( !entry.sSongGroup.empty() ) {