]> git.mxchange.org Git - simgear.git/commitdiff
Fix Dir warnings on Windows.
authorJames Turner <zakalawe@mac.com>
Mon, 21 Oct 2013 22:51:19 +0000 (23:51 +0100)
committerJames Turner <zakalawe@mac.com>
Mon, 21 Oct 2013 22:51:19 +0000 (23:51 +0100)
Test result of GetLastError so we don't log a warning in the
'nothing matched' case. Makes early startup logging much
more pleasant, especially when scanning aircraft dirs.

simgear/misc/sg_dir.cxx

index 9a084a6d0720981b0530182550b1b59366c2c490..5ffc10d67c29aa500e8f28d2552ee8550259bac9 100644 (file)
@@ -149,7 +149,11 @@ PathList Dir::children(int types, const std::string& nameFilter) const
   WIN32_FIND_DATA fData;
   HANDLE find = FindFirstFile(search.c_str(), &fData);
   if (find == INVALID_HANDLE_VALUE) {
-    SG_LOG(SG_GENERAL, SG_WARN, "Dir::children: FindFirstFile failed:" << _path.str());
+         int err = GetLastError();
+         if (err != ERROR_FILE_NOT_FOUND) {
+               SG_LOG(SG_GENERAL, SG_WARN, "Dir::children: FindFirstFile failed:" << 
+                       _path.str() << " with error:" << err);
+         }
     return result;
   }