Skip to content

Commit

Permalink
fixed error handling in create_dir()
Browse files Browse the repository at this point in the history
  • Loading branch information
kosloot committed Aug 28, 2024
1 parent 8315259 commit 9f9653c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/FileUtils.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,14 @@ namespace TiCC {
It will recursively create all intermediate directories when needed
*/
error_code ec;
filesystem::create_directory( p, ec );
return ec.value() == 0;
filesystem::create_directories( p, ec );
if ( ec.value() != EEXIST
&& ec.value() != 0 ){
throw runtime_error( "create_dir(" + string(p) + ") failed: "
+ ec.message() + " (" + std::to_string( ec.value())
+ ")" );
}
return true;
}

bool createPath( const string& name ){
Expand Down

0 comments on commit 9f9653c

Please sign in to comment.