diff --git a/aegisub/libaegisub/windows/fs.cpp b/aegisub/libaegisub/windows/fs.cpp index b075775e5..57c29d10f 100644 --- a/aegisub/libaegisub/windows/fs.cpp +++ b/aegisub/libaegisub/windows/fs.cpp @@ -32,6 +32,20 @@ namespace bfs = boost::filesystem; #undef CreateDirectory +namespace { + FINDEX_INFO_LEVELS find_info_level() { + OSVERSIONINFO osvi; + ZeroMemory(&osvi, sizeof(OSVERSIONINFO)); + osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx(&osvi); + + if (osvi.dwMajorVersion > 6 || (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion >= 1)) + return FindExInfoBasic; + else + return FindExInfoStandard; + } +} + namespace agi { namespace fs { std::string ShortName(path const& p) { std::wstring out(MAX_PATH + 1, 0); @@ -68,7 +82,7 @@ DirectoryIterator::DirectoryIterator(path const& p, std::string const& filter) : privdata(new PrivData) { WIN32_FIND_DATA data; - privdata->h = FindFirstFileEx((p/(filter.empty() ? "*.*" : filter)).c_str(), FindExInfoBasic, &data, FindExSearchNameMatch, nullptr, 0); + privdata->h = FindFirstFileEx((p/(filter.empty() ? "*.*" : filter)).c_str(), find_info_level(), &data, FindExSearchNameMatch, nullptr, 0); if (privdata->h == INVALID_HANDLE_VALUE) { privdata.reset(); return;