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