1
0
Fork 0

Add an option to enable or disable the save-on-exit option. Add a season commandline option.

This commit is contained in:
ehofman 2005-12-22 13:51:11 +00:00
parent ffa92dfe4b
commit b788a204c4
2 changed files with 22 additions and 19 deletions

View file

@ -39,6 +39,7 @@
#include "logger.hxx"
#include "util.hxx"
#include "viewmgr.hxx"
#include "main.hxx"
SG_USING_STD(string);
SG_USING_STD(ifstream);
@ -191,29 +192,28 @@ do_exit (const SGPropertyNode * arg)
{
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;

View file

@ -1297,6 +1297,8 @@ struct OptionDesc {
{"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 },
@ -1310,6 +1312,7 @@ struct OptionDesc {
{"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 },