MCPcopy Create free account
hub / github.com/creatale/node-dv / isDir

Function isDir

deps/opencv/modules/core/src/glob.cpp:140–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138#endif
139
140static 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
172static bool wildcmp(const char *string, const char *wild)
173{

Callers 2

glob_recFunction · 0.85
globMethod · 0.85

Calls 2

statClass · 0.70
c_strMethod · 0.45

Tested by

no test coverage detected