From 08a877cb8ec8f547131cec89d7413b3e1d3a1319 Mon Sep 17 00:00:00 2001 From: James Turner Date: Fri, 12 Jan 2018 20:22:33 +0000 Subject: [PATCH] Message box on start if FG-home is read-only MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If running with the launcher, and FG-home is read-only, show a warning to the user, since this is probably a surprise to them. (In non-launcher mode we don’t show the box, since it’s more likely to be an intentional duplicate launch) --- src/Main/main.cxx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Main/main.cxx b/src/Main/main.cxx index f552e1221..33fd66b14 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -465,7 +465,8 @@ int fgMainInit( int argc, char **argv ) return EXIT_FAILURE; } - if (!fgGetBool("/sim/fghome-readonly")) { + const bool readOnlyFGHome = fgGetBool("/sim/fghome-readonly"); + if (!readOnlyFGHome) { // now home is initialised, we can log to a file inside it logToHome(); } @@ -490,7 +491,7 @@ 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 +// check if the launcher is requested, 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. @@ -502,6 +503,13 @@ int fgMainInit( int argc, char **argv ) flightgear::Options::sharedInstance()->setShouldLoadDefaultConfig(false); } + if (showLauncher && readOnlyFGHome) { + // this is perhaps not what the user wanted, let's inform them + flightgear::modalMessageBox("Multiple copies of FlightGear", + "Another copy of FlightGear is already running on this computer, " + "so this copy will run in read-only mode."); + } + // Load the configuration parameters. (Command line options // override config file options. Config file options override // defaults.)