1
0
Fork 0

Ignore not-found 'config file' arguments.

Fixes confusing startup behaviour with malformed args, when
an argument accidentally contains a space (e.g. a park-pos or
protocol desc). In this case we treat the parts after the space as an XML config file name. When we can't find this file, we
completely abandon options setup, which causes many downstream
errors.

Change the behaviour so we warn in this case, but carry on with normal startup.
This commit is contained in:
James Turner 2014-03-27 08:05:02 +00:00
parent 19528fab8c
commit ca3cc03fac

View file

@ -1842,10 +1842,9 @@ void Options::init(int argc, char **argv, const SGPath& appDataPath)
SGPath f(argv[i]); SGPath f(argv[i]);
if (!f.exists()) { if (!f.exists()) {
SG_LOG(SG_GENERAL, SG_ALERT, "config file not found:" << f.str()); SG_LOG(SG_GENERAL, SG_ALERT, "config file not found:" << f.str());
return; } else {
p->propertyFiles.push_back(f);
} }
p->propertyFiles.push_back(f);
} }
} // of arguments iteration } // of arguments iteration
p->insertGroupMarker(); // command line is one group p->insertGroupMarker(); // command line is one group
@ -2170,11 +2169,6 @@ OptionResult Options::processOptions()
} }
BOOST_FOREACH(const SGPath& file, p->propertyFiles) { BOOST_FOREACH(const SGPath& file, p->propertyFiles) {
if (!file.exists()) {
SG_LOG(SG_GENERAL, SG_ALERT, "config file not found:" << file.str());
continue;
}
SG_LOG(SG_GENERAL, SG_INFO, SG_LOG(SG_GENERAL, SG_INFO,
"Reading command-line property file " << file.str()); "Reading command-line property file " << file.str());
readProperties(file.str(), globals->get_props()); readProperties(file.str(), globals->get_props());