mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-06 00:55:50 +00:00
bcc4d7a7c9
Signed-off-by: Lukasz Gromanowski <lgromanowski@gmail.com>
37 lines
1.1 KiB
C++
37 lines
1.1 KiB
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))
|
|
{
|
|
if (!recurse)
|
|
{
|
|
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 ))
|
|
{
|
|
ret.add(*itr);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
boost::filesystem::recursive_directory_iterator end_itr; // default construction yields past-the-end
|
|
for (boost::filesystem::recursive_directory_iterator itr(dir_path); itr != end_itr; ++itr)
|
|
{
|
|
if (!boost::filesystem::is_directory(*itr))
|
|
{
|
|
ret.add(*itr);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
std::cout << "Path " << dir_path << " not found" << std::endl;
|
|
}
|
|
}
|