Use GetPath with file names over accessing member variables
This commit is contained in:
committed by
Daniel J. H
parent
e208485c17
commit
d9e8caf369
@@ -43,36 +43,35 @@ namespace extractor
|
||||
struct ExtractorConfig final : storage::IOConfig
|
||||
{
|
||||
ExtractorConfig() noexcept : requested_num_threads(0),
|
||||
IOConfig({"", }, {}, {".osrm", ".osrm.restrictions", ".osrm.names", ".osrm.tls", ".osrm.tld", ".osrm.timestamp", ".osrm.geometry"
|
||||
, ".osrm.nbg_nodes", ".osrm.ebg_nodes", ".osrm.edges", ".osrm.ebg", ".osrm.ramIndex", ".osrm.fileIndex", ".osrm.turn_duration_penalties"
|
||||
, ".osrm.turn_weight_penalties", ".osrm.turn_penalties_index", ".osrm.enw", ".osrm.properties", ".osrm.icd", ".osrm.cnbg"
|
||||
, ".osrm.cnbg_to_ebg"})
|
||||
IOConfig(
|
||||
{
|
||||
"",
|
||||
},
|
||||
{},
|
||||
{".osrm",
|
||||
".osrm.restrictions",
|
||||
".osrm.names",
|
||||
".osrm.tls",
|
||||
".osrm.tld",
|
||||
".osrm.timestamp",
|
||||
".osrm.geometry",
|
||||
".osrm.nbg_nodes",
|
||||
".osrm.ebg_nodes",
|
||||
".osrm.edges",
|
||||
".osrm.ebg",
|
||||
".osrm.ramIndex",
|
||||
".osrm.fileIndex",
|
||||
".osrm.turn_duration_penalties",
|
||||
".osrm.turn_weight_penalties",
|
||||
".osrm.turn_penalties_index",
|
||||
".osrm.enw",
|
||||
".osrm.properties",
|
||||
".osrm.icd",
|
||||
".osrm.cnbg",
|
||||
".osrm.cnbg_to_ebg"})
|
||||
{
|
||||
}
|
||||
|
||||
void UseDefaultOutputNames()
|
||||
{
|
||||
std::string basepath = input_path.string();
|
||||
|
||||
// TODO move the known_extensions to IsValid
|
||||
auto pos = std::string::npos;
|
||||
std::array<std::string, 5> known_extensions{
|
||||
{".osm.bz2", ".osm.pbf", ".osm.xml", ".pbf", ".osm"}};
|
||||
for (auto ext : known_extensions)
|
||||
{
|
||||
pos = basepath.find(ext);
|
||||
if (pos != std::string::npos)
|
||||
{
|
||||
basepath.replace(pos, ext.size(), "");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
osrm_path = basepath + ".osrm";
|
||||
|
||||
IOConfig::UseDefaultOutputNames();
|
||||
}
|
||||
|
||||
boost::filesystem::path input_path;
|
||||
boost::filesystem::path profile_path;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user