mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-12 19:18:20 +00:00
improved FindFile so it stops on a match
This commit is contained in:
parent
f38fc81d78
commit
de1e8fc851
|
@ -304,6 +304,8 @@ public:
|
||||||
str_format(aPath, sizeof(aPath), "%s/%s", Data.pPath, pName);
|
str_format(aPath, sizeof(aPath), "%s/%s", Data.pPath, pName);
|
||||||
Data.pPath = aPath;
|
Data.pPath = aPath;
|
||||||
fs_listdir(Data.pStorage->GetPath(Type, aPath, aBuf, sizeof(aBuf)), FindFileCallback, Type, &Data);
|
fs_listdir(Data.pStorage->GetPath(Type, aPath, aBuf, sizeof(aBuf)), FindFileCallback, Type, &Data);
|
||||||
|
if(Data.pBuffer[0])
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
else if(!str_comp(pName, Data.pFilename))
|
else if(!str_comp(pName, Data.pFilename))
|
||||||
{
|
{
|
||||||
|
@ -333,7 +335,11 @@ public:
|
||||||
{
|
{
|
||||||
// search within all available directories
|
// search within all available directories
|
||||||
for(int i = 0; i < m_NumPaths; ++i)
|
for(int i = 0; i < m_NumPaths; ++i)
|
||||||
|
{
|
||||||
fs_listdir(GetPath(i, pPath, aBuf, sizeof(aBuf)), FindFileCallback, i, &Data);
|
fs_listdir(GetPath(i, pPath, aBuf, sizeof(aBuf)), FindFileCallback, i, &Data);
|
||||||
|
if(pBuffer[0])
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(Type >= 0 && Type < m_NumPaths)
|
else if(Type >= 0 && Type < m_NumPaths)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue