In SongID::ToSong, check whether the dir is empty before prepending a slash, so GetSongFromDir can be skipped when the dir is empty.
This commit is contained in:
+11
-8
@@ -1132,14 +1132,17 @@ Song *SongID::ToSong() const
|
|||||||
Song *pRet = NULL;
|
Song *pRet = NULL;
|
||||||
if( !m_Cache.Get(&pRet) )
|
if( !m_Cache.Get(&pRet) )
|
||||||
{
|
{
|
||||||
// HACK for backwards compatibility: Re-add the leading "/".
|
if(!sDir.empty())
|
||||||
// 2005/05/21 file layer changes added a leading slash.
|
{
|
||||||
RString sDir2 = sDir;
|
// HACK for backwards compatibility: Re-add the leading "/".
|
||||||
if( sDir2.Left(1) != "/" )
|
// 2005/05/21 file layer changes added a leading slash.
|
||||||
sDir2 = "/" + sDir2;
|
RString sDir2 = sDir;
|
||||||
|
if(sDir2.Left(1) != "/")
|
||||||
if( !sDir2.empty() )
|
{
|
||||||
pRet = SONGMAN->GetSongFromDir( sDir2 );
|
sDir2 = "/" + sDir2;
|
||||||
|
}
|
||||||
|
pRet = SONGMAN->GetSongFromDir(sDir2);
|
||||||
|
}
|
||||||
m_Cache.Set( pRet );
|
m_Cache.Set( pRet );
|
||||||
}
|
}
|
||||||
return pRet;
|
return pRet;
|
||||||
|
|||||||
Reference in New Issue
Block a user