Ancurio / mkxp

Free Software implementation of the Ruby Game Scripting System (RGSS)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pathCache search keeps searching even after file is found

LiEnby opened this issue · comments

commented

mkxp/src/filesystem.cpp

Lines 666 to 674 in 380b676

if (p->havePathCache)
{
/* Get the list of files contained in this directory
* and manually iterate over them */
const std::vector<std::string> &fileList = p->fileLists[dir];
for (size_t i = 0; i < fileList.size(); ++i)
openReadEnumCB(&data, dir, fileList[i].c_str());
}

if you see this for loop, it will always loop until the end of the list is found,
ideally you'd stop once PHYSFS_ENUM_STOP was returned, (file was found)

for (size_t i = 0; i < fileList.size(); ++i)
			if(openReadEnumCB(data, dir, fileList[i].c_str()) == PHYSFS_ENUM_STOP)
				break;

this is likely why #246 has gone unnoticed.