Loading a blank Song if a mp3/ogg file is present and no SM/KSF/DWI is present
This commit is contained in:
+27
-12
@@ -249,25 +249,40 @@ 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() );
|
bool success = ld->LoadFromDir( sDir, *this );
|
||||||
return false;
|
BlacklistedImages = ld->GetBlacklistedImages();
|
||||||
}
|
|
||||||
|
|
||||||
bool success = ld->LoadFromDir( sDir, *this );
|
if(!success)
|
||||||
BlacklistedImages = ld->GetBlacklistedImages();
|
{
|
||||||
|
delete ld;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
TidyUpData();
|
||||||
|
ld->TidyUpData( *this, false );
|
||||||
|
|
||||||
if(!success)
|
|
||||||
{
|
|
||||||
delete ld;
|
delete ld;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOG->Warn( "Couldn't find any SM, DWI, BMS, or KSF files in '%s'.", sDir.c_str() );
|
||||||
|
|
||||||
TidyUpData();
|
vector<CString> vs;
|
||||||
ld->TidyUpData( *this, false );
|
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
|
// save a cache file so we don't have to parse it all over again next time
|
||||||
SaveToCacheFile();
|
SaveToCacheFile();
|
||||||
|
|||||||
Reference in New Issue
Block a user