Loading a blank Song if a mp3/ogg file is present and no SM/KSF/DWI is present

This commit is contained in:
Chris Danford
2005-11-06 12:52:19 +00:00
parent a8247bd45b
commit ffbf54c263
+20 -5
View File
@@ -249,12 +249,8 @@ bool Song::LoadFromSongDir( CString sDir )
// //
NotesLoader *ld = MakeLoader( sDir ); NotesLoader *ld = MakeLoader( sDir );
if(!ld) if( ld )
{ {
LOG->Warn( "Couldn't find any SM, DWI, BMS, or KSF files in '%s'. This is not a valid song directory.", sDir.c_str() );
return false;
}
bool success = ld->LoadFromDir( sDir, *this ); bool success = ld->LoadFromDir( sDir, *this );
BlacklistedImages = ld->GetBlacklistedImages(); BlacklistedImages = ld->GetBlacklistedImages();
@@ -268,6 +264,25 @@ bool Song::LoadFromSongDir( CString sDir )
ld->TidyUpData( *this, false ); ld->TidyUpData( *this, false );
delete ld; delete ld;
}
else
{
LOG->Warn( "Couldn't find any SM, DWI, BMS, or KSF files in '%s'.", sDir.c_str() );
vector<CString> vs;
GetDirListing( sDir + "*.mp3", vs, false, false );
GetDirListing( sDir + "*.ogg", vs, false, false );
bool bHasMusic = !vs.empty();
if( !bHasMusic )
{
LOG->Warn( "No music file in this directory either. Ignoring this song directory." );
return false;
}
// Continue on with a blank Song so that people can make adjustments using the editor.
TidyUpData();
}
// save a cache file so we don't have to parse it all over again next time // save a cache file so we don't have to parse it all over again next time
SaveToCacheFile(); SaveToCacheFile();