Add a POSIX directory walk #11
Loading…
Reference in a new issue
No description provided.
Delete branch "fputs/dir"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds a POSIX directory walk in
lfdir.h.nextskips.and..and does not skip other dotfiles. Names are the directory entry, not a joined path, and there is no recursion.lf_path_joindoes not allocate. A short buffer or a NULL argument leaves the destination unchanged.LfDiris a complete struct so the caller can own the handle on the stack.dirandnameare private. A failedopendoes not write the handle, so a zeroed handle stays safe toclose.Empty
ainlf_path_joinyieldsbwith no extra slash.a/plusbisa/b.Tests use
mkdtempunder/tmpand remove the directory before the test returns.Tested with
-DCMAKE_BUILD_TYPE=Debug -DFLINT_SANITIZE=ON -DCMAKE_C_EXTENSIONS=OFF.ctest --label-exclude slow: 26/26 passed.b7e5d0e5858671a197238671a1972329e36931ec