Skip to content

Commit

Permalink
Merge 2ec4341 into 02b5045
Browse files Browse the repository at this point in the history
  • Loading branch information
rgugliel committed Feb 14, 2019
2 parents 02b5045 + 2ec4341 commit 78ae586
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
1 change: 1 addition & 0 deletions include/storage/io_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ struct IOConfig
}

bool IsValid() const;
std::vector<std::string> GetMissingFiles() const;
boost::filesystem::path GetPath(const std::string &fileName) const
{
if (!IsConfigured(fileName, required_input_files) &&
Expand Down
9 changes: 7 additions & 2 deletions src/osrm/osrm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include "engine/engine_config.hpp"
#include "engine/status.hpp"

#include <boost/algorithm/string/join.hpp>

#include <memory>

namespace osrm
Expand All @@ -25,8 +27,11 @@ OSRM::OSRM(engine::EngineConfig &config)
// First, check that necessary core data is available
if (!config.use_shared_memory && !config.storage_config.IsValid())
{
throw util::exception("Required files are missing, cannot continue. Have all the "
"pre-processing steps been run?");
const auto &missingFiles = config.storage_config.GetMissingFiles();
throw util::exception("Required files are missing, cannot continue. Have all the "
"pre-processing steps been run? "
"Missing files: " +
boost::algorithm::join(missingFiles, ", "));
}

// Now, check that the algorithm requested can be used with the data
Expand Down
13 changes: 13 additions & 0 deletions src/storage/io_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,18 @@ bool IOConfig::IsValid() const
}
return success;
}

std::vector<std::string> IOConfig::GetMissingFiles() const
{
std::vector<std::string> missingFiles;
for (auto &fileName : required_input_files)
{
if (!boost::filesystem::is_regular_file({base_path.string() + fileName.string()}))
{
missingFiles.push_back(base_path.string() + fileName.string());
}
}
return missingFiles;
}
}
}

0 comments on commit 78ae586

Please sign in to comment.