diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2015-10-16 19:42:47 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2015-10-17 00:11:20 +0100 |
commit | 11db442a6c9c13956133b5248a6aed7b9f462544 (patch) | |
tree | 871b552c35b4bad4023976402633e242ac907dd6 /src | |
parent | hardfork: use DB transactions when reorganizing (diff) | |
download | monero-11db442a6c9c13956133b5248a6aed7b9f462544.tar.xz |
bootstrap_file: do not try to create a directory with an empty name
This will happen if the chosen output file does not have a
path specified
Diffstat (limited to 'src')
-rw-r--r-- | src/blockchain_utilities/bootstrap_file.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/blockchain_utilities/bootstrap_file.cpp b/src/blockchain_utilities/bootstrap_file.cpp index ab841c8c6..d66d2f604 100644 --- a/src/blockchain_utilities/bootstrap_file.cpp +++ b/src/blockchain_utilities/bootstrap_file.cpp @@ -53,20 +53,23 @@ namespace bool BootstrapFile::open_writer(const boost::filesystem::path& file_path) { const boost::filesystem::path dir_path = file_path.parent_path(); - if (boost::filesystem::exists(dir_path)) + if (!dir_path.empty()) { - if (!boost::filesystem::is_directory(dir_path)) + if (boost::filesystem::exists(dir_path)) { - LOG_PRINT_RED_L0("export directory path is a file: " << dir_path); - return false; + if (!boost::filesystem::is_directory(dir_path)) + { + LOG_PRINT_RED_L0("export directory path is a file: " << dir_path); + return false; + } } - } - else - { - if (!boost::filesystem::create_directory(dir_path)) + else { - LOG_PRINT_RED_L0("Failed to create directory " << dir_path); - return false; + if (!boost::filesystem::create_directory(dir_path)) + { + LOG_PRINT_RED_L0("Failed to create directory " << dir_path); + return false; + } } } |