Fix DoFileSearch returning the passed-in directories themselves.

Fixes https://code.google.com/p/dolphin-emu/issues/detail?id=8697&can=3
This commit is contained in:
comex 2015-06-21 16:03:32 -04:00
parent f6d27a5ce8
commit acd6cb79a4
2 changed files with 5 additions and 6 deletions

View File

@ -28,7 +28,8 @@ static std::vector<std::string> FileSearchWithTest(const std::vector<std::string
for (auto& child : entry.children) for (auto& child : entry.children)
DoEntry(child); DoEntry(child);
}; };
DoEntry(top); for (auto& child : top.children)
DoEntry(child);
} }
// remove duplicates // remove duplicates
std::sort(result.begin(), result.end()); std::sort(result.begin(), result.end());
@ -53,6 +54,7 @@ std::vector<std::string> DoFileSearch(const std::vector<std::string>& globs, con
}); });
} }
// Result includes the passed directories themselves as well as their subdirectories.
std::vector<std::string> FindSubdirectories(const std::vector<std::string>& directories, bool recursive) std::vector<std::string> FindSubdirectories(const std::vector<std::string>& directories, bool recursive)
{ {
return FileSearchWithTest(directories, true, [&](const File::FSTEntry& entry) { return FileSearchWithTest(directories, true, [&](const File::FSTEntry& entry) {

View File

@ -80,16 +80,13 @@ void DGameTracker::ScanForGames()
delete m_watcher; delete m_watcher;
m_watcher = new QFileSystemWatcher(this); m_watcher = new QFileSystemWatcher(this);
for (std::string dir : SConfig::GetInstance().m_ISOFolder)
m_watcher->addPath(QString::fromStdString(dir));
if (SConfig::GetInstance().m_RecursiveISOFolder) if (SConfig::GetInstance().m_RecursiveISOFolder)
{ {
for (std::string dir : FindSubdirectories(SConfig::GetInstance().m_ISOFolder, /*recursive*/ true)) for (std::string dir : FindSubdirectories(SConfig::GetInstance().m_ISOFolder, /*recursive*/ true))
m_watcher->addPath(QString::fromStdString(dir)); m_watcher->addPath(QString::fromStdString(dir));
} }
else
{
for (std::string dir : SConfig::GetInstance().m_ISOFolder)
m_watcher->addPath(QString::fromStdString(dir));
}
std::vector<std::string> exts; std::vector<std::string> exts;
if (SConfig::GetInstance().m_ListGC) if (SConfig::GetInstance().m_ListGC)