Skip to content

Add incremental directory iterator#145

Open
rovolhetch wants to merge 5 commits intotsoding:mainfrom
rovolhetch:feat/dir-iter
Open

Add incremental directory iterator#145
rovolhetch wants to merge 5 commits intotsoding:mainfrom
rovolhetch:feat/dir-iter

Conversation

@rovolhetch
Copy link

@rovolhetch rovolhetch commented Oct 6, 2025

Related PR:

This PR features an incremental directory iterator to nob.h.

New functions in this PR:

  • nob_is_dir_empty()
  • nob_dir_iter_open()
  • nob_dir_iter_next()
  • nob_dir_iter_close()
  • nob_dir_iter_getname()

New structure in this PR:

  • Nob_Dir_Iter

Ues cases:

  • Walking directory recusively
  • Deleting directory recusively
  • etc.

Example:

Nob_Dir_Iter iter = {0};
if (nob_dir_iter_open(&iter, "./src")) {
    while (nob_dir_iter_next(&iter)) {
        const char *name = nob_dir_iter_getname(iter);
        // processing
    }
    nob_dir_iter_close(iter);
}

Functions:
- `nob_is_dir_empty()`
- `nob_dir_iter_open()`
- `nob_dir_iter_next()`
- `nob_dir_iter_close()`
- `nob_dir_iter_getname()`
@rovolhetch rovolhetch marked this pull request as draft October 6, 2025 14:56
@rovolhetch rovolhetch marked this pull request as ready for review October 6, 2025 15:46
@rovolhetch rovolhetch mentioned this pull request Oct 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant