]> git.mxchange.org Git - flightgear.git/blobdiff - src/GUI/new_gui.cxx
Support for multiple data dirs.
[flightgear.git] / src / GUI / new_gui.cxx
index 4975b193fa40498e30ee2c59d4c7c6c14f90b218..8ca5c12c5b9c03845f50713325e9aba92e1d4448 100644 (file)
@@ -76,6 +76,9 @@ NewGUI::init ()
     readDir(p);
     const std::string aircraft_dir(fgGetString("/sim/aircraft-dir"));
     readDir( SGPath(aircraft_dir, "gui/dialogs") );
+    
+    // Fix for http://code.google.com/p/flightgear-bugs/issues/detail?id=947
+    fgGetNode("sim/menubar")->setAttribute(SGPropertyNode::PRESERVE, true);
     _menubar->init();
 }
 
@@ -142,6 +145,7 @@ NewGUI::unbind ()
 void
 NewGUI::update (double delta_time_sec)
 {
+    SG_UNUSED(delta_time_sec);
     map<string,FGDialog *>::iterator iter = _active_dialogs.begin();
     for(/**/; iter != _active_dialogs.end(); iter++)
         iter->second->update();
@@ -289,9 +293,15 @@ NewGUI::newDialog (SGPropertyNode* props)
 void
 NewGUI::readDir (const SGPath& path)
 {
+    simgear::Dir dir(path);
+    if( !dir.exists() )
+    {
+      SG_LOG(SG_INPUT, SG_INFO, "directory does not exist: " << path.str());
+      return;
+    }
+
     flightgear::NavDataCache* cache = flightgear::NavDataCache::instance();
     flightgear::NavDataCache::Transaction txn(cache);
-    simgear::Dir dir(path);
     simgear::PathList xmls = dir.children(simgear::Dir::TYPE_FILE, ".xml");
     
     BOOST_FOREACH(SGPath xmlPath, xmls) {
@@ -323,6 +333,8 @@ NewGUI::readDir (const SGPath& path)
       cache->stampCacheFile(xmlPath);
       cache->writeStringProperty(xmlPath.str(), name);
     } // of directory children iteration
+  
+    txn.commit();
 }\f
 ////////////////////////////////////////////////////////////////////////
 // Style handling.