Skip to content

Commit

Permalink
Find .h
Browse files Browse the repository at this point in the history
  • Loading branch information
an-tao committed Jul 25, 2021
1 parent bac0f8e commit 1178e02
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions drogon_ctl/create_swagger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include <fstream>

using namespace drogon_ctl;
using drogon::filesystem;

static void forEachControllerHeaderIn(
std::string strPath,
Expand All @@ -54,20 +53,24 @@ static void forEachControllerHeaderIn(
return;

std::error_code ec;
filesystem::path fsPath(strPath);
if (!filesystem::exists(strPath, ec))
drogon::filesystem::path fsPath(strPath);
if (!drogon::filesystem::exists(strPath, ec))
{
return;
}
for (auto &itr : filesystem::directory_iterator(fsPath))
for (auto &itr : drogon::filesystem::directory_iterator(fsPath))
{
if (filesystem::is_directory(itr.status()))
if (drogon::filesystem::is_directory(itr.status()))
{
forEachControllerHeaderIn(itr.path().string(), cb);
}
else
{
cb(itr.path().string());
auto fileName = itr.path().string();
if (fileName.find(".h") == fileName.length() - 2)
{
cb(fileName);
}
}
}
return;
Expand Down

0 comments on commit 1178e02

Please sign in to comment.