diff --git a/utils/fgviewer/fgviewer.cxx b/utils/fgviewer/fgviewer.cxx index 42f2104ca..e59a91645 100644 --- a/utils/fgviewer/fgviewer.cxx +++ b/utils/fgviewer/fgviewer.cxx @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -109,7 +110,17 @@ main(int argc, char** argv) } SGSharedPtr props = new SGPropertyNode; - props->getNode("sim/startup/season", true)->setStringValue("summer"); + try { + SGPath preferencesFile = fg_root; + preferencesFile.append("preferences.xml"); + readProperties(preferencesFile.str(), props); + } catch (...) { + // In case of an error, at least make summer :) + props->getNode("sim/startup/season", true)->setStringValue("summer"); + + std::cerr << "Problems loading FlightGear preferences.\n" + << "Probably FG_ROOT is not properly set." << std::endl; + } SGMaterialLib* ml = new SGMaterialLib; SGPath mpath(fg_root); mpath.append("materials.xml");