Hopefully fixed infinite recursion.

This commit is contained in:
Aloshi 2013-04-13 17:30:57 -05:00
parent 4a05288e71
commit 608545118a
3 changed files with 9 additions and 16 deletions

View file

@ -1,3 +1,9 @@
April 13, 2013
-Finally merged the unstable branch, which means better input everything!
-Can now use multiple joysticks.
-Can now remap keyboard input.
-Hopefully prevented infinitely recursing symlinks.
March 28, 2013 March 28, 2013
-Hopefully fixed bad joystick events at startup. -Hopefully fixed bad joystick events at startup.

View file

@ -88,20 +88,6 @@ void SystemData::launchGame(Window* window, GameData* game)
window->init(); window->init();
} }
bool SystemData::containsFolder(FolderData* root, const std::string& path)
{
for(int i = 0; i < root->getFileCount(); i++)
{
FileData* f = root->getFile(i);
if(f->isFolder())
{
if(f->getPath() == path || containsFolder((FolderData*)f, path))
return true;
}
}
return false;
}
void SystemData::populateFolder(FolderData* folder) void SystemData::populateFolder(FolderData* folder)
{ {
std::string folderPath = folder->getPath(); std::string folderPath = folder->getPath();
@ -114,8 +100,10 @@ void SystemData::populateFolder(FolderData* folder)
//make sure that this isn't a symlink to a thing we already have //make sure that this isn't a symlink to a thing we already have
if(fs::is_symlink(folderPath)) if(fs::is_symlink(folderPath))
{ {
if(containsFolder(mRootFolder, folderPath)) //if this symlink resolves to somewhere that's at the beginning of our path, it's gonna recurse
if(folderPath.find(fs::canonical(folderPath).string()) == 0)
{ {
LOG(LogWarning) << "Skipping infinitely recursive symlink \"" << folderPath << "\"";
return; return;
} }
} }

View file

@ -38,7 +38,6 @@ private:
std::string mLaunchCommand; std::string mLaunchCommand;
void populateFolder(FolderData* folder); void populateFolder(FolderData* folder);
bool containsFolder(FolderData* folder, const std::string& path);
FolderData* mRootFolder; FolderData* mRootFolder;
}; };