MCPcopy Create free account
hub / github.com/WaykiChain/WaykiChain / TryCreateDirectory

Function TryCreateDirectory

src/commons/util/util.cpp:724–733  ·  view source on GitHub ↗

Ignores exceptions thrown by boost's create_directory if the requested directory exists. Specifically handles case where path p exists, but it wasn't possible for the user to write to the parent directory.

Source from the content-addressed store, hash-verified

722// Specifically handles case where path p exists, but it wasn't possible for the user to write to
723// the parent directory.
724bool TryCreateDirectory(const boost::filesystem::path& p) {
725 try {
726 return boost::filesystem::create_directory(p);
727 } catch (const boost::filesystem::filesystem_error&) {
728 if (!boost::filesystem::exists(p) || !boost::filesystem::is_directory(p)) throw;
729 }
730
731 // create_directory didn't create the directory, it had to have existed already
732 return false;
733}
734
735void FileCommit(FILE* fileout) {
736 fflush(fileout); // harmless if redundantly called

Callers 3

OpenMethod · 0.85
CLevelDBWrapperMethod · 0.85
GetDefaultDataDirFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected