1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-09 21:42:13 +00:00
OpenMW/components/file_finder/search.cpp
Lukasz Gromanowski b004e2479c Issue #133 Handle resources across multiple data directories - WIP
Work In Progress - added support for multiple paths in SoundManager.

Signed-off-by: Lukasz Gromanowski <lgromanowski@gmail.com>
2012-01-29 20:27:03 +01:00

29 lines
700 B
C++

#include "search.hpp"
#include <iostream>
void FileFinder::find(const boost::filesystem::path & dir_path, ReturnPath &ret, bool recurse)
{
if ( !boost::filesystem::exists( dir_path ) )
{
std::cout << "Path " << dir_path << " not found" << std::endl;
return;
}
boost::filesystem::directory_iterator end_itr; // default construction yields past-the-end
for (boost::filesystem::directory_iterator itr(dir_path); itr != end_itr; ++itr)
{
if (boost::filesystem::is_directory( *itr ))
{
if (recurse)
{
find(*itr, ret);
}
}
else
{
ret.add(*itr);
}
}
}