- ulDir *dir = ulOpenDir(path.c_str());
- if (dir) {
- ulDirEnt* dent;
- while ((dent = ulReadDir(dir)) != 0) {
- if (dent->d_name[0] == '.')
- continue;
+ if (!path.exists())
+ return;
+
+ flightgear::NavDataCache* cache = flightgear::NavDataCache::instance();
+ flightgear::NavDataCache::Transaction txn(cache);
+
+ simgear::Dir dir(path);
+ simgear::PathList children = dir.children(simgear::Dir::TYPE_FILE |
+ simgear::Dir::TYPE_DIR | simgear::Dir::NO_DOT_OR_DOTDOT);
+
+ BOOST_FOREACH(SGPath path, children) {
+ if (path.isDir()) {
+ scan_dir(path);
+ } else if (path.extension() == "xml") {
+ if (cache->isCachedFileModified(path)) {
+ refreshCacheForFile(path);
+ } else {
+ readCachedData(path);
+ } // of cached file stamp is valid
+ } // of child is a file with '.xml' extension
+ } // of directory children iteration
+
+ txn.commit();
+}