Skip to content

Commit

Permalink
Fix problem with boost create_directories
Browse files Browse the repository at this point in the history
  • Loading branch information
akenmorris committed Feb 6, 2024
1 parent 17ac0e7 commit ef3bcd8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Libs/Groom/Groom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,9 @@ std::string Groom::get_output_filename(std::string input, DomainType domain_type
path = base + "/" + prefix;

try {
boost::filesystem::create_directories(path);
if (!boost::filesystem::exists(path)) {
boost::filesystem::create_directories(path);
}
} catch (std::exception& e) {
throw std::runtime_error("Unable to create groom output directory: \"" + path + "\"");
}
Expand Down
4 changes: 3 additions & 1 deletion Libs/Image/Image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,9 @@ Image& Image::write(const std::string& filename, bool compressed) {

// if the directory doesn't exist, create it
boost::filesystem::path dir(filename);
boost::filesystem::create_directories(dir.parent_path());
if (dir.has_parent_path() && !boost::filesystem::exists(dir.parent_path())) {
boost::filesystem::create_directories(dir.parent_path());
}

using WriterType = itk::ImageFileWriter<ImageType>;
WriterType::Pointer writer = WriterType::New();
Expand Down

0 comments on commit ef3bcd8

Please sign in to comment.