Skip to content

Commit

Permalink
Improve create_parent_directories
Browse files Browse the repository at this point in the history
  • Loading branch information
Jackarain committed Oct 19, 2023
1 parent 70cf05a commit d2b47ec
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions proxy/include/proxy/fileop.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,16 @@ namespace fileop {
{
std::error_code ec;

if (std::filesystem::exists(p, ec) || ec)
if (std::filesystem::exists(p, ec))
return true;

if (ec)
return false;

if (!p.parent_path().empty())
{
if (std::filesystem::create_directories(p.parent_path(), ec) || ec)
std::filesystem::create_directories(p.parent_path(), ec);
if (ec)
return false;
}

Expand Down

0 comments on commit d2b47ec

Please sign in to comment.