about summary refs log tree commit diff
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2011-04-07 18:45:24 +0200
committeroy <Tom_Adams@web.de>2011-04-07 18:45:24 +0200
commitde1e8fc851af63fb65557b1921a472265462d58e (patch)
treeddc270c687894600276e219c6b7e4660683f7742
parentf38fc81d7872c5c617690026700d55e9c256a30f (diff)
downloadzcatch-de1e8fc851af63fb65557b1921a472265462d58e.tar.gz
zcatch-de1e8fc851af63fb65557b1921a472265462d58e.zip
improved FindFile so it stops on a match
-rw-r--r--src/engine/shared/storage.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/engine/shared/storage.cpp b/src/engine/shared/storage.cpp
index 2c7fafea..db19fcdc 100644
--- a/src/engine/shared/storage.cpp
+++ b/src/engine/shared/storage.cpp
@@ -304,6 +304,8 @@ public:
 			str_format(aPath, sizeof(aPath), "%s/%s", Data.pPath, pName);
 			Data.pPath = aPath;
 			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))
 		{
@@ -333,7 +335,11 @@ public:
 		{
 			// search within all available directories
 			for(int i = 0; i < m_NumPaths; ++i)
+			{
 				fs_listdir(GetPath(i, pPath, aBuf, sizeof(aBuf)), FindFileCallback, i, &Data);
+				if(pBuffer[0])
+					return true;
+			}
 		}
 		else if(Type >= 0 && Type < m_NumPaths)
 		{