diff --git a/stepmania/src/CourseUtil.cpp b/stepmania/src/CourseUtil.cpp index 36e09e6792..3ceaf4872c 100644 --- a/stepmania/src/CourseUtil.cpp +++ b/stepmania/src/CourseUtil.cpp @@ -213,13 +213,24 @@ void CourseID::FromCourse( const Course *p ) sPath = ""; sFullTitle = ""; } + + // HACK for backwards compatibility: + // Strip off leading "/". 2005/05/21 file layer changes added a leading slash. + if( sPath.Left(1) == "/" ) + sPath.erase( sPath.begin() ); } Course *CourseID::ToCourse() const { - if( !sPath.empty() ) + // HACK for backwards compatibility: + // Re-add the leading "/". 2005/05/21 file layer changes added a leading slash. + CString sPath2 = sPath; + if( sPath2.Left(1) != "/" ) + sPath2.erase( sPath2.begin() ); + + if( !sPath2.empty() ) { - Course *pCourse = SONGMAN->GetCourseFromPath( sPath ); + Course *pCourse = SONGMAN->GetCourseFromPath( sPath2 ); if( pCourse ) return pCourse; } diff --git a/stepmania/src/SongUtil.cpp b/stepmania/src/SongUtil.cpp index 4aa56abdf9..fb17961564 100644 --- a/stepmania/src/SongUtil.cpp +++ b/stepmania/src/SongUtil.cpp @@ -379,11 +379,22 @@ void SongID::FromSong( const Song *p ) sDir = p->GetSongDir(); else sDir = ""; + + // HACK for backwards compatibility: + // Strip off leading "/". 2005/05/21 file layer changes added a leading slash. + if( sDir.Left(1) == "/" ) + sDir.erase( sDir.begin() ); } Song *SongID::ToSong() const { - return SONGMAN->GetSongFromDir( sDir ); + // HACK for backwards compatibility: + // Re-add the leading "/". 2005/05/21 file layer changes added a leading slash. + CString sDir2 = sDir; + if( sDir2.Left(1) != "/" ) + sDir2.erase( sDir2.begin() ); + + return SONGMAN->GetSongFromDir( sDir2 ); } XNode* SongID::CreateNode() const