Skip to content

Instantly share code, notes, and snippets.

@ELD
Created March 17, 2015 19:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ELD/99b90c42ba438aaca7e1 to your computer and use it in GitHub Desktop.
Save ELD/99b90c42ba438aaca7e1 to your computer and use it in GitHub Desktop.
std::vector<std::string> getVmFiles(const boost::filesystem::path& dirToSearch)
{
std::vector<std::string> files;
for (const auto& file : boost::make_iterator_range(boost::filesystem::recursive_directory_iterator{dirToSearch}, {})) {
std::regex vmFile{R"((?:.*).vm)"};
if (boost::filesystem::is_regular_file(file) && std::regex_search(file.path().string().begin(), file.path().string().end(), vmFile)) {
files.emplace_back(file.path().string());
}
}
return files;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment