Maintain storage_config exposed API
This commit is contained in:
committed by
Daniel J. H
parent
0b5c7a97a7
commit
8da40419ee
@@ -23,6 +23,21 @@ struct IOConfig
|
||||
{
|
||||
}
|
||||
|
||||
bool IsValid() const;
|
||||
boost::filesystem::path GetPath(const std::string &fileName) const
|
||||
{
|
||||
if (!IsConfigured(fileName, required_input_files) &&
|
||||
!IsConfigured(fileName, optional_input_files) && !IsConfigured(fileName, output_files))
|
||||
{
|
||||
throw util::exception("Tried to access file which is not configured: " + fileName);
|
||||
}
|
||||
|
||||
return {base_path.string() + fileName};
|
||||
}
|
||||
|
||||
boost::filesystem::path base_path;
|
||||
|
||||
protected:
|
||||
// Infer the base path from the path of the .osrm file
|
||||
void UseDefaultOutputNames(const boost::filesystem::path &base)
|
||||
{
|
||||
@@ -45,20 +60,6 @@ struct IOConfig
|
||||
base_path = {path};
|
||||
}
|
||||
|
||||
bool IsValid() const;
|
||||
boost::filesystem::path GetPath(const std::string &fileName) const
|
||||
{
|
||||
if (!IsConfigured(fileName, required_input_files) &&
|
||||
!IsConfigured(fileName, optional_input_files) && !IsConfigured(fileName, output_files))
|
||||
{
|
||||
throw util::exception("Tried to access file which is not configured: " + fileName);
|
||||
}
|
||||
|
||||
return {base_path.string() + fileName};
|
||||
}
|
||||
|
||||
boost::filesystem::path base_path;
|
||||
|
||||
private:
|
||||
static bool IsConfigured(const std::string &fileName,
|
||||
const std::vector<boost::filesystem::path> &paths)
|
||||
|
||||
@@ -44,6 +44,11 @@ namespace storage
|
||||
*/
|
||||
struct StorageConfig final : IOConfig
|
||||
{
|
||||
StorageConfig(const boost::filesystem::path &base) : StorageConfig()
|
||||
{
|
||||
IOConfig::UseDefaultOutputNames(base);
|
||||
}
|
||||
|
||||
StorageConfig()
|
||||
: IOConfig({".osrm.ramIndex",
|
||||
".osrm.fileIndex",
|
||||
|
||||
Reference in New Issue
Block a user