| 389 | } |
| 390 | |
| 391 | _TINYDIR_FUNC |
| 392 | int tinydir_open_subdir_n(tinydir_dir *dir, size_t i) { |
| 393 | char path[_TINYDIR_PATH_MAX]; |
| 394 | if (dir == NULL) { |
| 395 | errno = EINVAL; |
| 396 | return -1; |
| 397 | } |
| 398 | if (i >= dir->n_files || !dir->_files[i].is_dir) { |
| 399 | errno = ENOENT; |
| 400 | return -1; |
| 401 | } |
| 402 | |
| 403 | strcpy(path, dir->_files[i].path); |
| 404 | tinydir_close(dir); |
| 405 | if (tinydir_open_sorted(dir, path) == -1) { |
| 406 | return -1; |
| 407 | } |
| 408 | |
| 409 | return 0; |
| 410 | } |
| 411 | |
| 412 | /* Open a single file given its path */ |
| 413 | _TINYDIR_FUNC |
nothing calls this directly
no test coverage detected