]> git.mxchange.org Git - flightgear.git/commitdiff
close Aircraft/ dir after scanning for *-set.xml files
authormfranz <mfranz>
Tue, 14 Mar 2006 15:28:29 +0000 (15:28 +0000)
committermfranz <mfranz>
Tue, 14 Mar 2006 15:28:29 +0000 (15:28 +0000)
src/Main/fg_init.cxx

index 9f210ef7ec39f30d3ea716f3ddc19072c08bbf31..95ac6684aed65b67299e7a7554d3f84f4d252ce3 100644 (file)
@@ -516,6 +516,7 @@ static string fgFindAircraftPath( const SGPath &path, const string &aircraft ) {
         exit(-1);
     }
 
+    string result;
     while ((dire = ulReadDir(dirp)) != NULL) {
         if (dire->d_isdir) {
             if ( strcmp("CVS", dire->d_name) && strcmp(".", dire->d_name)
@@ -524,19 +525,18 @@ static string fgFindAircraftPath( const SGPath &path, const string &aircraft ) {
                 SGPath next = path;
                 next.append(dire->d_name);
 
-                string result = fgFindAircraftPath( next, aircraft );
+                result = fgFindAircraftPath( next, aircraft );
                 if ( ! result.empty() ) {
-                    return result;
+                    break;
                 }
             }
         } else if ( !strcmp(dire->d_name, aircraft.c_str()) ) {
-            return path.str();
+            result = path.str();
         }
     }
 
     ulCloseDir(dirp);
-
-    return "";
+    return result;
 }