1
0
Fork 0

[main] Maintenance

This commit is contained in:
scttgs0 2023-05-14 12:14:20 -05:00
parent c8ea78fbe6
commit fba4f3634d

View file

@ -95,12 +95,14 @@ static void help(int argc, char** argv, const string_list& elev_src)
std::cout << *elev_src_it << "\n";
}
std::cout << "\n";
usage(argc, argv);
}
void setLoggingPriority(const std::string& priority)
{
SG_LOG(SG_ALL, SG_ALERT, "setting log level to " << priority);
if (priority == "bulk") {
sglog().set_log_priority(SG_BULK);
} else if (priority == "debug") {
@ -155,6 +157,7 @@ int main(int argc, char** argv)
int arg_pos;
for (arg_pos = 1; arg_pos < argc; arg_pos++) {
std::string arg = argv[arg_pos];
if (arg.compare(0, 12, "--log-level=") == 0) {
setLoggingPriority(arg.substr(12));
} else if (arg.compare(0, 7, "--work=") == 0) {
@ -209,7 +212,7 @@ int main(int argc, char** argv)
}
}
std::string airportareadir = work_dir + "/AirportArea";
std::string airportAreaDir = work_dir + "/AirportArea";
// this is the main program -
TG_LOG(SG_GENERAL, SG_INFO, "Genapts version " << getTGVersion() << " running with " << num_threads << " threads");
@ -219,6 +222,7 @@ int main(int argc, char** argv)
TG_LOG(SG_GENERAL, SG_INFO, "Longitude = " << min.getLongitudeDeg() << ':' << max.getLongitudeDeg());
TG_LOG(SG_GENERAL, SG_INFO, "Latitude = " << min.getLatitudeDeg() << ':' << max.getLatitudeDeg());
TG_LOG(SG_GENERAL, SG_INFO, "Terrain sources = ");
for (unsigned int i = 0; i < elev_src.size(); ++i) {
TG_LOG(SG_GENERAL, SG_INFO, " " << work_dir << "/" << elev_src[i]);
}
@ -232,20 +236,20 @@ int main(int argc, char** argv)
// make work directory
TG_LOG(SG_GENERAL, SG_DEBUG, "Creating AirportArea directory");
SGPath sgp(airportareadir);
SGPath sgp(airportAreaDir);
sgp.append("dummy");
sgp.create_dir(0755);
tgRectangle boundingBox(min, max);
boundingBox.sanify();
if (work_dir == "") {
if (work_dir.empty()) {
TG_LOG(SG_GENERAL, SG_ALERT, "Error: no work directory specified.");
usage(argc, argv);
return EXIT_FAILURE;
}
if (input_file == "") {
if (input_file.empty()) {
TG_LOG(SG_GENERAL, SG_ALERT, "Error: no input file.");
return EXIT_FAILURE;
}
@ -274,7 +278,7 @@ int main(int argc, char** argv)
scheduler->set_debug(debug_dir, debug_runway_defs, debug_pavement_defs, debug_taxiway_defs, debug_feature_defs);
// just one airport
if (airport_id != "") {
if (!airport_id.empty()) {
// just find and add the one airport
scheduler->AddAirport(airport_id);
@ -284,7 +288,7 @@ int main(int argc, char** argv)
scheduler->Schedule(num_threads, summary_file);
}
else if (start_id != "") {
else if (!start_id.empty()) {
TG_LOG(SG_GENERAL, SG_INFO, "move forward to " << start_id);
// scroll forward in datafile