Fix Dir warnings on Windows.

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.
This commit is contained in:
James Turner
2013-10-21 23:51:19 +01:00
parent 77aa2c9a9d
commit 784223c67f

View 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;
}