mirror of
https://github.com/monero-project/monero.git
synced 2024-12-25 04:59:43 +00:00
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
This commit is contained in:
parent
03bc6100de
commit
11db442a6c
1 changed files with 13 additions and 10 deletions
|
@ -53,20 +53,23 @@ namespace
|
||||||
bool BootstrapFile::open_writer(const boost::filesystem::path& file_path)
|
bool BootstrapFile::open_writer(const boost::filesystem::path& file_path)
|
||||||
{
|
{
|
||||||
const boost::filesystem::path dir_path = file_path.parent_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);
|
if (!boost::filesystem::is_directory(dir_path))
|
||||||
return false;
|
{
|
||||||
|
LOG_PRINT_RED_L0("export directory path is a file: " << dir_path);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!boost::filesystem::create_directory(dir_path))
|
|
||||||
{
|
{
|
||||||
LOG_PRINT_RED_L0("Failed to create directory " << dir_path);
|
if (!boost::filesystem::create_directory(dir_path))
|
||||||
return false;
|
{
|
||||||
|
LOG_PRINT_RED_L0("Failed to create directory " << dir_path);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue