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
+27 -12
View File
@@ -249,25 +249,40 @@ bool Song::LoadFromSongDir( CString 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 );
BlacklistedImages = ld->GetBlacklistedImages();
bool success = ld->LoadFromDir( sDir, *this );
BlacklistedImages = ld->GetBlacklistedImages();
if(!success)
{
delete ld;
return false;
}
TidyUpData();
ld->TidyUpData( *this, false );
if(!success)
{
delete ld;
return false;
}
else
{
LOG->Warn( "Couldn't find any SM, DWI, BMS, or KSF files in '%s'.", sDir.c_str() );
TidyUpData();
ld->TidyUpData( *this, false );
vector<CString> vs;
GetDirListing( sDir + "*.mp3", vs, false, false );
GetDirListing( sDir + "*.ogg", vs, false, false );
bool bHasMusic = !vs.empty();
delete ld;
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
SaveToCacheFile();