MCPcopy Create free account
hub / github.com/apache/nuttx / host_readdir

Function host_readdir

arch/sim/src/sim/win/sim_hostfs.c:310–335  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

308 ****************************************************************************/
309
310int host_readdir(void *dirp, struct nuttx_dirent_s *entry)
311{
312 WIN32_FIND_DATA FileData;
313 BOOL ret;
314
315 ret = FindNextFile(dirp, &FileData);
316 if (ret == FALSE)
317 {
318 return GetLastError() == ERROR_NO_MORE_FILES ?
319 -ENOENT : HRESULT_FROM_WIN32(GetLastError());
320 }
321
322 strncpy(entry->d_name, FileData.cFileName,
323 sizeof(entry->d_name) - 1);
324
325 if (FileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
326 {
327 entry->d_type = NUTTX_DTYPE_DIRECTORY;
328 }
329 else
330 {
331 entry->d_type = NUTTX_DTYPE_FILE;
332 }
333
334 return 0;
335}
336
337/****************************************************************************
338 * Name: host_rewinddir

Callers

nothing calls this directly

Calls 1

strncpyFunction · 0.50

Tested by

no test coverage detected