Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pathCache search keeps searching even after file is found #247

Open
LiEnby opened this issue Dec 22, 2021 · 0 comments
Open

pathCache search keeps searching even after file is found #247

LiEnby opened this issue Dec 22, 2021 · 0 comments

Comments

@LiEnby
Copy link

LiEnby commented Dec 22, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant