Skip to content

Commit

Permalink
Fix conversion with empty directories
Browse files Browse the repository at this point in the history
  • Loading branch information
lamyj committed May 22, 2018
1 parent d441143 commit 1bbf896
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions src/lib/bruker/Directory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,24 +139,19 @@ ::get_series_and_reco(const std::string &path)

for(RecursiveIterator it(path); it != RecursiveIterator(); ++it)
{
if(it->path().filename() == "id" || it->path().filename() == "reco")
auto const & path = it->path();
if(path.filename() == "id" || path.filename() == "reco")
{
for(Iterator reco_it(it->path().parent_path().parent_path());
reco_it != Iterator(); ++reco_it)
auto const series =
path.parent_path().parent_path().parent_path().filename().string();
auto const reconstruction = path.parent_path().filename().string();

auto & reconstructions = series_and_reco[series];
if(std::find(
reconstructions.begin(), reconstructions.end(),
reconstruction) == reconstructions.end())
{
if(boost::filesystem::is_directory(reco_it->path()))
{
std::string const reconstruction = ((Path)*reco_it).filename().string();
std::string const series = ((Path)*reco_it).parent_path().parent_path().filename().string();

auto & reconstructions = series_and_reco[series];
if(std::find(
reconstructions.begin(), reconstructions.end(),
reconstruction) == reconstructions.end())
{
reconstructions.push_back(reconstruction);
}
}
reconstructions.push_back(reconstruction);
}
}
}
Expand Down

0 comments on commit 1bbf896

Please sign in to comment.