Use GetPath with file names over accessing member variables
This commit is contained in:
committed by
Daniel J. H
parent
e208485c17
commit
d9e8caf369
@@ -79,7 +79,7 @@ return_code parseArguments(int argc, char *argv[], contractor::ContractorConfig
|
||||
boost::program_options::options_description hidden_options("Hidden options");
|
||||
hidden_options.add_options()(
|
||||
"input,i",
|
||||
boost::program_options::value<boost::filesystem::path>(&contractor_config.osrm_path),
|
||||
boost::program_options::value<boost::filesystem::path>(&contractor_config.base_path),
|
||||
"Input file in .osm, .osm.bz2 or .osm.pbf format");
|
||||
|
||||
// positional option
|
||||
@@ -153,7 +153,7 @@ int main(int argc, char *argv[]) try
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
contractor_config.UseDefaultOutputNames();
|
||||
contractor_config.UseDefaultOutputNames(contractor_config.base_path);
|
||||
|
||||
if (1 > contractor_config.requested_num_threads)
|
||||
{
|
||||
@@ -169,14 +169,14 @@ int main(int argc, char *argv[]) try
|
||||
<< "! This setting may have performance side-effects.";
|
||||
}
|
||||
|
||||
if (!boost::filesystem::is_regular_file(contractor_config.osrm_path))
|
||||
if (!boost::filesystem::is_regular_file(contractor_config.GetPath(".osrm")))
|
||||
{
|
||||
util::Log(logERROR) << "Input file " << contractor_config.osrm_path.string()
|
||||
util::Log(logERROR) << "Input file " << contractor_config.GetPath(".osrm").string()
|
||||
<< " not found!";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
util::Log() << "Input file: " << contractor_config.osrm_path.filename().string();
|
||||
util::Log() << "Input file: " << contractor_config.GetPath(".osrm").filename().string();
|
||||
util::Log() << "Threads: " << contractor_config.requested_num_threads;
|
||||
|
||||
tbb::task_scheduler_init init(contractor_config.requested_num_threads);
|
||||
|
||||
@@ -72,7 +72,7 @@ parseArguments(int argc, char *argv[], customizer::CustomizationConfig &customiz
|
||||
boost::program_options::options_description hidden_options("Hidden options");
|
||||
hidden_options.add_options()(
|
||||
"input,i",
|
||||
boost::program_options::value<boost::filesystem::path>(&customization_config.osrm_path),
|
||||
boost::program_options::value<boost::filesystem::path>(&customization_config.base_path),
|
||||
"Input file in .osrm format");
|
||||
|
||||
// positional option
|
||||
@@ -145,7 +145,7 @@ int main(int argc, char *argv[]) try
|
||||
}
|
||||
|
||||
// set the default in/output names
|
||||
customization_config.UseDefaultOutputNames();
|
||||
customization_config.UseDefaultOutputNames(customization_config.base_path);
|
||||
|
||||
if (1 > customization_config.requested_num_threads)
|
||||
{
|
||||
@@ -153,9 +153,9 @@ int main(int argc, char *argv[]) try
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (!boost::filesystem::is_regular_file(customization_config.osrm_path))
|
||||
if (!boost::filesystem::is_regular_file(customization_config.GetPath(".osrm")))
|
||||
{
|
||||
util::Log(logERROR) << "Input file " << customization_config.osrm_path.string()
|
||||
util::Log(logERROR) << "Input file " << customization_config.GetPath(".osrm").string()
|
||||
<< " not found!";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ int main(int argc, char *argv[]) try
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
extractor_config.UseDefaultOutputNames();
|
||||
extractor_config.UseDefaultOutputNames(extractor_config.input_path);
|
||||
|
||||
if (1 > extractor_config.requested_num_threads)
|
||||
{
|
||||
|
||||
@@ -114,7 +114,7 @@ return_code parseArguments(int argc, char *argv[], partition::PartitionConfig &c
|
||||
boost::program_options::options_description hidden_options("Hidden options");
|
||||
hidden_options.add_options()(
|
||||
"input,i",
|
||||
boost::program_options::value<boost::filesystem::path>(&config.osrm_path),
|
||||
boost::program_options::value<boost::filesystem::path>(&config.base_path),
|
||||
"Input file in .osrm format");
|
||||
|
||||
// positional option
|
||||
@@ -199,7 +199,7 @@ int main(int argc, char *argv[]) try
|
||||
}
|
||||
|
||||
// set the default in/output names
|
||||
partition_config.UseDefaultOutputNames();
|
||||
partition_config.UseDefaultOutputNames(partition_config.base_path);
|
||||
|
||||
if (1 > partition_config.requested_num_threads)
|
||||
{
|
||||
@@ -219,9 +219,9 @@ int main(int argc, char *argv[]) try
|
||||
}
|
||||
};
|
||||
|
||||
if (!check_file(partition_config.edge_based_graph_path) ||
|
||||
!check_file(partition_config.cnbg_ebg_mapping_path) ||
|
||||
!check_file(partition_config.compressed_node_based_graph_path))
|
||||
if (!check_file(partition_config.GetPath(".osrm.ebg")) ||
|
||||
!check_file(partition_config.GetPath(".osrm.cnbg_to_ebg")) ||
|
||||
!check_file(partition_config.GetPath(".osrm.cnbg")))
|
||||
{
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
@@ -229,7 +229,7 @@ int main(int argc, const char *argv[]) try
|
||||
}
|
||||
if (!base_path.empty())
|
||||
{
|
||||
config.storage_config = storage::StorageConfig(base_path);
|
||||
config.storage_config.UseDefaultOutputNames(base_path);
|
||||
}
|
||||
if (!config.use_shared_memory && !config.storage_config.IsValid())
|
||||
{
|
||||
|
||||
+2
-1
@@ -163,7 +163,8 @@ int main(const int argc, const char *argv[]) try
|
||||
{
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
storage::StorageConfig config(base_path);
|
||||
storage::StorageConfig config;
|
||||
config.UseDefaultOutputNames(base_path);
|
||||
if (!config.IsValid())
|
||||
{
|
||||
util::Log(logERROR) << "Config contains invalid file paths. Exiting!";
|
||||
|
||||
Reference in New Issue
Block a user