1
0
Fork 0

fgFindAircraftPath(): put the MAX_DEPTH check at a place where it makes sense

This commit is contained in:
mfranz 2007-04-02 23:19:36 +00:00
parent 3cb5b0159d
commit 1eb5de245b

View file

@ -517,10 +517,14 @@ static string fgFindAircraftPath( const SGPath &path, const string &aircraft, in
string result;
while ((dire = ulReadDir(dirp)) != NULL) {
if (dire->d_isdir && depth < MAXDEPTH) {
if ( strcmp("CVS", dire->d_name) && strcmp(".", dire->d_name)
&& strcmp("..", dire->d_name) && strcmp("AI", dire->d_name))
{
if (dire->d_isdir) {
if (depth > MAXDEPTH)
continue;
if (!strcmp("CVS", dire->d_name) || !strcmp(".", dire->d_name)
|| !strcmp("..", dire->d_name) || !strcmp("AI", dire->d_name))
continue;
SGPath next = path;
next.append(dire->d_name);
@ -528,7 +532,7 @@ static string fgFindAircraftPath( const SGPath &path, const string &aircraft, in
if ( ! result.empty() ) {
break;
}
}
} else if ( !strcmp(dire->d_name, aircraft.c_str()) ) {
result = path.str();
break;