1
0
Fork 0

don't search *-set.xml files in the the *complete* $FG_ROOT/Aircraft/ tree

(including all subdirs and with max depth!), but only the outmost level.
There are no *-set.xml files in deeper nested dirs, and with an ever growing
number of aircraft the search just lasts too long.
This commit is contained in:
mfranz 2007-01-15 20:58:20 +00:00
parent 92772f23b1
commit b7a7de4f30

View file

@ -507,7 +507,8 @@ do_options (int argc, char ** argv)
} }
static string fgFindAircraftPath( const SGPath &path, const string &aircraft ) { #define MAXDEPTH 1
static string fgFindAircraftPath( const SGPath &path, const string &aircraft, int depth = 0 ) {
ulDirEnt* dire; ulDirEnt* dire;
ulDir *dirp = ulOpenDir(path.str().c_str()); ulDir *dirp = ulOpenDir(path.str().c_str());
if (dirp == NULL) { if (dirp == NULL) {
@ -517,14 +518,14 @@ static string fgFindAircraftPath( const SGPath &path, const string &aircraft ) {
string result; string result;
while ((dire = ulReadDir(dirp)) != NULL) { while ((dire = ulReadDir(dirp)) != NULL) {
if (dire->d_isdir) { if (dire->d_isdir && depth < MAXDEPTH) {
if ( strcmp("CVS", dire->d_name) && strcmp(".", dire->d_name) if ( strcmp("CVS", dire->d_name) && strcmp(".", dire->d_name)
&& strcmp("..", dire->d_name) && strcmp("AI", dire->d_name)) && strcmp("..", dire->d_name) && strcmp("AI", dire->d_name))
{ {
SGPath next = path; SGPath next = path;
next.append(dire->d_name); next.append(dire->d_name);
result = fgFindAircraftPath( next, aircraft ); result = fgFindAircraftPath( next, aircraft, depth + 1 );
if ( ! result.empty() ) { if ( ! result.empty() ) {
break; break;
} }