From: James Turner Date: Thu, 27 Mar 2014 08:05:02 +0000 (+0000) Subject: Ignore not-found 'config file' arguments. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ca3cc03fac9de5de080564ab0bc6b1a55ea32651;p=flightgear.git 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. --- diff --git a/src/Main/options.cxx b/src/Main/options.cxx index 9ec346493..2cf964944 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -1842,10 +1842,9 @@ void Options::init(int argc, char **argv, const SGPath& appDataPath) SGPath f(argv[i]); if (!f.exists()) { 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 p->insertGroupMarker(); // command line is one group @@ -2170,11 +2169,6 @@ OptionResult Options::processOptions() } 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, "Reading command-line property file " << file.str()); readProperties(file.str(), globals->get_props());