Created
August 22, 2017 21:32
-
-
Save stryku/5866a14233f877cc594e9147d5e30331 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool findMatchingFiles(std::vector<std::string> &files) | |
{ | |
SmallVector<char, 256> currentPath; | |
std::error_code ec; | |
llvm::sys::fs::file_status fileStatus; | |
llvm::sys::fs::current_path(currentPath); | |
for (llvm::sys::fs::recursive_directory_iterator I(currentPath, ec), E; | |
I != E; I.increment(ec)) { | |
if (ec) { | |
errs() << "error: error wile recursive files formatting. Error code: " | |
<< ec.value(); | |
return true; | |
} | |
I->status(fileStatus); | |
if (fileStatus.type() == llvm::sys::fs::file_type::regular_file) | |
{ | |
std::vector<Regex> regexs{ std::cbegin(FileNames), std::cend(FileNames) }; | |
for (auto& regex : regexs) { | |
if (regex.match(I->path())) { | |
files.push_back(I->path()); | |
} | |
} | |
} | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment