1
0
Fork 0

Rename preferences.xml -> defaults.xml

Requires FGData commit: 0565eaab10a5d466cd485766b17d1870936a0a57
(which actually renames the file).

Also disables the preferences-load command since I don’t believe it
would actually be safe to reload the defaults without doing a simulator
reset (aircraft -set.xml values would be overwritten, for example)
This commit is contained in:
James Turner 2017-01-11 17:58:22 +00:00
parent 2098593531
commit 78498c560d
9 changed files with 23 additions and 19 deletions

View file

@ -167,7 +167,7 @@ FGFlightRecorder::getDefault(void)
const char* Path = m_RecorderNode->getStringValue("default-config",NULL);
if (!Path)
{
SG_LOG(SG_SYSTEMS, SG_ALERT, "FlightRecorder: No default flight recorder specified! Check preferences.xml!");
SG_LOG(SG_SYSTEMS, SG_ALERT, "FlightRecorder: No default flight recorder specified! Check defaults.xml!");
}
else
{

View file

@ -126,7 +126,7 @@ bool SetupRootDialog::validatePath(QString path)
// no harm
QStringList files = QStringList()
<< "version"
<< "preferences.xml"
<< "defaults.xml"
<< "Materials/base/materials-base.xml"
<< "gui/menubar.xml"
<< "Timezone/zone.tab";

View file

@ -104,7 +104,7 @@ void Transponder::init()
_idCode_node = node->getChild("id-code", 0, true);
_idCode_node->addChangeListener(this);
// set default, but don't overwrite value from preferences.xml or -set.xml
// set default, but don't overwrite value from defaults.xml or -set.xml
if (!_idCode_node->hasValue()) {
_idCode_node->setIntValue(1200);
}

View file

@ -395,15 +395,12 @@ do_panel_load (const SGPropertyNode * arg)
static bool
do_preferences_load (const SGPropertyNode * arg)
{
try {
fgLoadProps(arg->getStringValue("path", "preferences.xml"),
globals->get_props());
} catch (const sg_exception &e) {
guiErrorMessage("Error reading global preferences: ", e);
// disabling this command which was formerly used to reload 'preferences.xml'
// reloading the defaults doesn't make sense (better to reset the simulator),
// and loading arbitrary XML docs into the property-tree can be done via
// the standard load-xml command.
SG_LOG(SG_GENERAL, SG_ALERT, "preferences-load command is deprecated and non-functional");
return false;
}
SG_LOG(SG_INPUT, SG_INFO, "Successfully read global preferences.");
return true;
}
static void

View file

@ -472,10 +472,17 @@ int fgInitConfig ( int argc, char **argv, bool reinit )
options->init(argc, argv, dataPath);
}
// Read global preferences from $FG_ROOT/preferences.xml
SG_LOG(SG_GENERAL, SG_INFO, "Reading global preferences");
fgLoadProps("preferences.xml", globals->get_props());
SG_LOG(SG_GENERAL, SG_INFO, "Finished Reading global preferences");
// Read global defaults from $FG_ROOT/defaults
SG_LOG(SG_GENERAL, SG_INFO, "Reading global defaults");
SGPath defaultsXML = globals->get_fg_root() / "defaults.xml";
if (!defaultsXML.exists()) {
flightgear::fatalMessageBox("Missing files",
"Couldn't load an essential simulator data file",
defaultsXML.utf8Str());
}
fgLoadProps("defaults.xml", globals->get_props());
SG_LOG(SG_GENERAL, SG_INFO, "Finished Reading global defaults");
// do not load user settings when reset to default is requested, or if
// told to explicitly ignore

View file

@ -190,7 +190,7 @@ FGLocale::selectLanguage(const char *language)
if (!_currentLocale)
{
SG_LOG(SG_GENERAL, SG_ALERT,
"System locale not found or no internationalization settings specified in preferences.xml. Using default (en)." );
"System locale not found or no internationalization settings specified in defaults.xml. Using default (en)." );
return false;
}

View file

@ -112,7 +112,7 @@ static int fgSetupProxy( const char *arg );
/**
* Set a few fail-safe default property values.
*
* These should all be set in $FG_ROOT/preferences.xml, but just
* These should all be set in $FG_ROOT/defaults.xml, but just
* in case, we provide some initial sane values here. This method
* should be invoked *before* reading any init files.
*/

View file

@ -124,7 +124,7 @@ main(int argc, char** argv)
SGSharedPtr<SGPropertyNode> props = new SGPropertyNode;
try {
SGPath preferencesFile = fg_root;
preferencesFile.append("preferences.xml");
preferencesFile.append("defaults.xml");
readProperties(preferencesFile, props);
} catch (...) {
// In case of an error, at least make summer :)

View file

@ -85,7 +85,7 @@ main(int argc, char** argv)
SGSharedPtr<SGPropertyNode> props = new SGPropertyNode;
try {
SGPath preferencesFile = fg_root;
preferencesFile.append("preferences.xml");
preferencesFile.append("defaults.xml");
readProperties(preferencesFile, props);
} catch (...) {
// In case of an error, at least make summer :)