1
0
Fork 0

Launcher sets —no-default-config automatically.

This commit is contained in:
James Turner 2016-09-08 11:41:40 +01:00
parent 0d069f2581
commit feb10c4c43
3 changed files with 25 additions and 7 deletions

View file

@ -482,6 +482,18 @@ int fgMainInit( int argc, char **argv )
upper_case_property("/sim/tower/airport-id");
upper_case_property("/autopilot/route-manager/input");
// check if the launcher is reuested, since it affects config file parsing
bool showLauncher = flightgear::Options::checkForArg(argc, argv, "launcher");
// an Info.plist bundle can't define command line arguments, but it can set
// environment variables. This avoids needed a wrapper shell-script on OS-X.
showLauncher |= (::getenv("FG_LAUNCHER") != 0);
if (showLauncher) {
// to minimise strange interactions when launcher and config files
// set overlaping options, we disable the default files. Users can
// still explicitly request config files via --config options if they choose.
flightgear::Options::sharedInstance()->setShouldLoadDefaultConfig(false);
}
// Load the configuration parameters. (Command line options
// override config file options. Config file options override
// defaults.)
@ -493,11 +505,6 @@ int fgMainInit( int argc, char **argv )
}
#if defined(HAVE_QT)
bool showLauncher = flightgear::Options::checkForArg(argc, argv, "launcher");
// an Info.plist bundle can't define command line arguments, but it can set
// environment variables. This avoids needed a wrapper shell-script on OS-X.
showLauncher |= (::getenv("FG_LAUNCHER") != 0);
if (showLauncher) {
flightgear::initApp(argc, argv);
if (!flightgear::runLauncherDialog()) {

View file

@ -2628,6 +2628,11 @@ bool Options::shouldLoadDefaultConfig() const
return p->shouldLoadDefaultConfig;
}
void Options::setShouldLoadDefaultConfig(bool load)
{
p->shouldLoadDefaultConfig = load;
}
bool Options::checkForArg(int argc, char* argv[], const char* checkArg)
{
for (int i = 0; i < argc; ++i) {

View file

@ -128,13 +128,19 @@ public:
/**
* should defualt configuration files be loaded and processed or not?
* There's many configuration files we have historically read by default
* on startup - preferences.xml, fgfs.rc in various places and so on.
* on startup - fgfs.rc in various places and so on.
* --no-default-config allows this behaviour to be changed, so only
* expicitly listed files are read - this is useful for testing. Expose
* expicitly listed files are read Expose
* the value of the option here.
*/
bool shouldLoadDefaultConfig() const;
/**
* when using the built-in launcher, we disable the default config files.
* explicitly loaded confg files are still permitted.
*/
void setShouldLoadDefaultConfig(bool load);
/**
* check if the arguments array contains a particular string (with a '--' or
* '-' prefix).