|
@@ -292,6 +292,10 @@ DWORD SaveCefclientLog(std::string magicStr)
|
|
|
|
|
|
std::vector<std::string> find_files(const std::string srcPath, const std::string fileName, bool isDir)
|
|
|
{
|
|
|
+ std::vector<std::string> ret;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
static boost::xpressive::sregex_compiler rc;
|
|
|
if (!rc[fileName].regex_id())
|
|
|
{
|
|
@@ -300,19 +304,22 @@ std::vector<std::string> find_files(const std::string srcPath, const std::string
|
|
|
rc[fileName] = rc.compile(str);
|
|
|
}
|
|
|
|
|
|
- std::vector<std::string> ret;
|
|
|
-
|
|
|
- if (!boost::filesystem::exists(srcPath) || !boost::filesystem::is_directory(srcPath))
|
|
|
- return ret;
|
|
|
+
|
|
|
+ try {
|
|
|
+ if (!boost::filesystem::exists(srcPath) || !boost::filesystem::is_directory(srcPath))
|
|
|
+ return ret;
|
|
|
|
|
|
- typedef boost::filesystem::recursive_directory_iterator rd_iterator;
|
|
|
- rd_iterator end;
|
|
|
- for (rd_iterator pos(srcPath); pos != end; ++pos)
|
|
|
- {
|
|
|
- if ((isDir ? boost::filesystem::is_directory(*pos) : !boost::filesystem::is_directory(*pos)) && boost::xpressive::regex_match(pos->path().filename().string(), rc[fileName]))
|
|
|
- ret.emplace_back(pos->path().string());
|
|
|
+ typedef boost::filesystem::recursive_directory_iterator rd_iterator;
|
|
|
+ rd_iterator end;
|
|
|
+ for (rd_iterator pos(srcPath); pos != end; ++pos)
|
|
|
+ {
|
|
|
+ if ((isDir ? boost::filesystem::is_directory(*pos) : !boost::filesystem::is_directory(*pos)) && boost::xpressive::regex_match(pos->path().filename().string(), rc[fileName]))
|
|
|
+ ret.emplace_back(pos->path().string());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (const boost::filesystem::filesystem_error& e) {
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Error: %s", e.what());
|
|
|
}
|
|
|
-
|
|
|
return ret;
|
|
|
}
|
|
|
|