| 138 | #endif |
| 139 | |
| 140 | static bool isDir(const cv::String& path, DIR* dir) |
| 141 | { |
| 142 | #if defined WIN32 || defined _WIN32 || defined WINCE |
| 143 | DWORD attributes; |
| 144 | BOOL status = TRUE; |
| 145 | if (dir) |
| 146 | attributes = dir->data.dwFileAttributes; |
| 147 | else |
| 148 | { |
| 149 | WIN32_FILE_ATTRIBUTE_DATA all_attrs; |
| 150 | #ifdef HAVE_WINRT |
| 151 | wchar_t wpath[MAX_PATH]; |
| 152 | size_t copied = mbstowcs(wpath, path.c_str(), MAX_PATH); |
| 153 | CV_Assert((copied != MAX_PATH) && (copied != (size_t)-1)); |
| 154 | status = ::GetFileAttributesExW(wpath, GetFileExInfoStandard, &all_attrs); |
| 155 | #else |
| 156 | status = ::GetFileAttributesExA(path.c_str(), GetFileExInfoStandard, &all_attrs); |
| 157 | #endif |
| 158 | attributes = all_attrs.dwFileAttributes; |
| 159 | } |
| 160 | |
| 161 | return status && ((attributes & FILE_ATTRIBUTE_DIRECTORY) != 0); |
| 162 | #else |
| 163 | (void)dir; |
| 164 | struct stat stat_buf; |
| 165 | if (0 != stat( path.c_str(), &stat_buf)) |
| 166 | return false; |
| 167 | int is_dir = S_ISDIR( stat_buf.st_mode); |
| 168 | return is_dir != 0; |
| 169 | #endif |
| 170 | } |
| 171 | |
| 172 | static bool wildcmp(const char *string, const char *wild) |
| 173 | { |