You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openmw-tes3coop/components/file_finder/search.cpp

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;
}
}