]> git.mxchange.org Git - flightgear.git/commitdiff
Fix —show-aircraft with multiple aircraft dirs
authorJames Turner <zakalawe@mac.com>
Thu, 9 Apr 2015 14:31:09 +0000 (15:31 +0100)
committerJames Turner <zakalawe@mac.com>
Thu, 9 Apr 2015 14:31:09 +0000 (15:31 +0100)
Patch from Jens Thoms Toerring

src/Main/options.cxx

index 5d7b67e190980d196f2dd61facdb704efef71215..4b168fd6818155855a5684d98da282be04703c9a 100644 (file)
@@ -251,9 +251,11 @@ public:
     }
     
     
-    void show(const SGPath& path)
+    void show(const vector<SGPath> & path_list)
     {
-        visitDir(path, 0);
+               for (vector<SGPath>::const_iterator p = path_list.begin();
+                        p != path_list.end(); ++p)
+                       visitDir(*p, 0);
         
         simgear::requestConsole(); // ensure console is shown on Windows
         
@@ -348,10 +350,10 @@ private:
  *
  * @parampath the directory to search for configuration files
  */
-void fgShowAircraft(const SGPath &path)
+void fgShowAircraft(const vector<SGPath> &path_list)
 {
     ShowAircraft s;
-    s.show(path);
+    s.show(path_list);
     
 #ifdef _MSC_VER
     cout << "Hit a key to continue..." << endl;
@@ -1994,10 +1996,24 @@ void Options::initAircraft()
   }
     
   if (p->showAircraft) {
+       vector<SGPath> path_list;
+
     fgOptLogLevel( "alert" );
-    SGPath path( globals->get_fg_root() );
-    path.append("Aircraft");
-    fgShowAircraft(path);
+
+    // First place to check is the 'Aircraft' sub-directory in $FG_ROOT
+
+       path_list.push_back( SGPath( globals->get_fg_root() ) );
+       path_list.back().append("Aircraft");
+
+    // Additionally, aircraft may also be found in user-defined places
+       // (via $FG_AIRCRAFT or with the '--fg-aircraft' option)
+
+       string_list aircraft_paths = globals->get_aircraft_paths();
+       for (string_list::iterator it = aircraft_paths.begin();
+                it != aircraft_paths.end(); ++it)
+         path_list.push_back( SGPath(*it));
+
+    fgShowAircraft(path_list);
     exit(0);
   }