#include "logger.hxx"
#include "util.hxx"
#include "viewmgr.hxx"
+#include "main.hxx"
SG_USING_STD(string);
SG_USING_STD(ifstream);
{
SG_LOG(SG_INPUT, SG_INFO, "Program exit requested.");
+ if (fgGetBool("/sim/startup/save-on-exit")) {
#ifdef _MSC_VER
- char* envp = ::getenv( "APPDATA" );
+ char* envp = ::getenv( "APPDATA" );
+ if ( envp != NULL ) {
+ SGPath config( envp );
+ config.append( "flightgear.org" );
#else
- char* envp = ::getenv( "HOME" );
+ if ( homedir != NULL ) {
+ SGPath config( homedir );
+ config.append( ".fgfs" );
#endif
- if ( envp != NULL ) {
- SGPath config( globals->get_fg_root() );
- config.set( envp );
-#ifdef _MSC_VER
- config.append( "flightgear.org" );
-#else
- config.append( ".fgfs" );
-#endif
- config.append( "preferences.xml" );
- config.create_dir( 0700 );
- SG_LOG(SG_IO, SG_INFO, "Saving user preferences");
- try {
- writeProperties(config.str(), globals->get_props(), false, SGPropertyNode::USERARCHIVE);
- } catch (const sg_exception &e) {
- guiErrorMessage("Error saving preferences: ", e);
- }
+ config.append( "preferences.xml" );
+ config.create_dir( 0700 );
+ SG_LOG(SG_IO, SG_INFO, "Saving user preferences");
+ try {
+ writeProperties(config.str(), globals->get_props(), false, SGPropertyNode::USERARCHIVE);
+ } catch (const sg_exception &e) {
+ guiErrorMessage("Error saving preferences: ", e);
+ }
- SG_LOG(SG_INPUT, SG_BULK, "Finished Saving user preferences");
+ SG_LOG(SG_INPUT, SG_BULK, "Finished Saving user preferences");
+ }
}
fgExit(arg->getIntValue("status", 0));
return true;
{"aspect-ratio-multiplier", true, OPTION_DOUBLE, "/sim/current-view/aspect-ratio-multiplier", false, "", 0 },
{"disable-fullscreen", false, OPTION_BOOL, "/sim/startup/fullscreen", false, "", 0 },
{"enable-fullscreen", false, OPTION_BOOL, "/sim/startup/fullscreen", true, "", 0 },
+ {"disable-save-on-exit", false, OPTION_BOOL, "/sim/startup/save-on-exit", false, "", 0 },
+ {"enable-save-on-exit", false, OPTION_BOOL, "/sim/startup/save-on-exit", true, "", 0 },
{"shading-flat", false, OPTION_BOOL, "/sim/rendering/shading", false, "", 0 },
{"shading-smooth", false, OPTION_BOOL, "/sim/rendering/shading", true, "", 0 },
{"disable-skyblend", false, OPTION_BOOL, "/sim/rendering/skyblend", false, "", 0 },
{"units-feet", false, OPTION_STRING, "/sim/startup/units", false, "feet", 0 },
{"units-meters", false, OPTION_STRING, "/sim/startup/units", false, "meters", 0 },
{"timeofday", true, OPTION_STRING, "/sim/startup/time-offset-type", false, "noon", 0 },
+ {"season", true, OPTION_STRING, "/sim/startup/season", false, "summer", 0 },
{"time-offset", true, OPTION_FUNC, "", false, "", fgOptTimeOffset },
{"time-match-real", false, OPTION_STRING, "/sim/startup/time-offset-type", false, "system-offset", 0 },
{"time-match-local", false, OPTION_STRING, "/sim/startup/time-offset-type", false, "latitude-offset", 0 },