diff options
author | Marko Bencun <marko.bencun@monetas.net> | 2017-02-22 18:10:00 +0900 |
---|---|---|
committer | Marko Bencun <marko.bencun@monetas.net> | 2017-06-14 00:04:13 +0200 |
commit | 1d1ea9f0962a331c21a3029a0302e5906a396f56 (patch) | |
tree | 0d4f9a7b2ff1d68ad35fa42cf05f05fff0ae6b51 /src/util.cpp | |
parent | a4ca0b042365061020627a8c045cddacea3312ec (diff) |
Turn TryCreateDirectory() into TryCreateDirectories()
Use case: TryCreateDirectory(GetDataDir() / "blocks" / "index") would
fail if the blocks directory was not explicitly created before.
The line that did so was in a weird location and could be removed as a
result.
Diffstat (limited to 'src/util.cpp')
-rw-r--r-- | src/util.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/util.cpp b/src/util.cpp index 653a4f072a..1ad4fa262c 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -653,21 +653,21 @@ bool RenameOver(fs::path src, fs::path dest) } /** - * Ignores exceptions thrown by Boost's create_directory if the requested directory exists. + * Ignores exceptions thrown by Boost's create_directories 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. */ -bool TryCreateDirectory(const fs::path& p) +bool TryCreateDirectories(const fs::path& p) { try { - return fs::create_directory(p); + return fs::create_directories(p); } catch (const fs::filesystem_error&) { if (!fs::exists(p) || !fs::is_directory(p)) throw; } - // create_directory didn't create the directory, it had to have existed already + // create_directories didn't create the directory, it had to have existed already return false; } |