From cf2236351c28ab5bda0da5c4d5cc2cb21a14842f Mon Sep 17 00:00:00 2001 From: ThorstenB Date: Sat, 20 Aug 2011 23:02:26 +0200 Subject: [PATCH] Avoid some useless file accesses Empty "markers" in between scenery search paths shouldn't be considered when building search paths. --- src/Airports/xmlloader.cxx | 17 ++++++++++------- src/Scenery/tilemgr.cxx | 15 +++++++++------ 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/Airports/xmlloader.cxx b/src/Airports/xmlloader.cxx index 3d65f7756..273e2f67f 100644 --- a/src/Airports/xmlloader.cxx +++ b/src/Airports/xmlloader.cxx @@ -96,13 +96,16 @@ bool XMLLoader::findAirportData(const std::string& aICAO, aICAO.c_str(), fileName.c_str()); for (string_list_iterator it = sc.begin(); it != sc.end(); ++it) { - SGPath path(*it); - path.append("Airports"); - path.append(string(buffer)); - if (path.exists()) { - aPath = path; - return true; - } // of path exists + // fg_senery contains empty strings as "markers" (see FGGlobals::set_fg_scenery) + if (!it->empty()) { + SGPath path(*it); + path.append("Airports"); + path.append(string(buffer)); + if (path.exists()) { + aPath = path; + return true; + } // of path exists + } } // of scenery path iteration return false; } diff --git a/src/Scenery/tilemgr.cxx b/src/Scenery/tilemgr.cxx index 75e0b9f92..52cadfd05 100644 --- a/src/Scenery/tilemgr.cxx +++ b/src/Scenery/tilemgr.cxx @@ -255,12 +255,15 @@ FGTileMgr::loadTileModel(const string& modelPath, bool cacheModel) string_list sc = globals->get_fg_scenery(); for (string_list_iterator it = sc.begin(); it != sc.end(); ++it) { - SGPath tmpPath(*it); - tmpPath.append(modelPath); - if (tmpPath.exists()) { - fullPath = tmpPath; - break; - } + // fg_senery contains empty strings as "markers" (see FGGlobals::set_fg_scenery) + if (!it->empty()) { + SGPath tmpPath(*it); + tmpPath.append(modelPath); + if (tmpPath.exists()) { + fullPath = tmpPath; + break; + } + } } } else { fullPath.append(modelPath);