Skip to content

Conversation

@gaogao-qwq
Copy link

@gaogao-qwq gaogao-qwq commented Aug 23, 2025

Basically just a GNU Make wildcard() function.

e.g. For folders with the following hierarchy (which is a common case for C/C++ developers nowadays, sigh).

.
├── external
│   ├── foobar
│   │   ├── foobar.h
│   │   ├── libfoobar.a
│   │   └── libfoobar.so
│   └── foobarbaz
│       ├── foobarbaz.h
│       ├── libfoobarbaz.a
│       └── libfoobarbaz.so
├── include
│   ├── bar
│   │   └── bar.h
│   ├── baz.h
│   └── foo
│       └── foo.h
└── src
    ├── bar
    │   └── bar.c
    ├── baz.c
    └── foo
        └── foo.c

Running read_entire_dir(".", &children) will give u a list of

.
..
src
external
include

Running read_entire_dir(".", &children, .recursively = true) will give u a list of

src/bar/bar.c
src/baz.c
src/foo/foo.c
external/foobarbaz/libfoobarbaz.a
external/foobarbaz/libfoobarbaz.so
external/foobarbaz/foobarbaz.h
external/foobar/libfoobar.a
external/foobar/foobar.h
external/foobar/libfoobar.so
include/bar/bar.h
include/baz.h
include/foo/foo.h

Running read_entire_dir(".", &dlls, .wildcard = "external/**/*.so" will give u a list of

external/foobarbaz/libfoobarbaz.so
external/foobar/libfoobar.so

@gaogao-qwq gaogao-qwq force-pushed the recursively-wildcard branch 4 times, most recently from a53d37b to 31ea253 Compare August 24, 2025 01:23
…ely_wildcard`

Basically just a GNU Make wildcard() function

Signed-off-by: gaogao-qwq <gaogaoqwq@gmail.com>
@gaogao-qwq gaogao-qwq force-pushed the recursively-wildcard branch from 31ea253 to 3851c4a Compare August 24, 2025 01:29
@rexim
Copy link
Member

rexim commented Aug 24, 2025

These functions give me the same vibe as nob_cmd_run_sync_redirect_and_reset. Maybe .recursively and .wildcard should be optional parameters like in nob_cmd_run()?

@gaogao-qwq gaogao-qwq changed the title Implement read_entire_dir_recursively and read_entire_dir_recursively_wildcard Implement recursively & wildcard functionality for nob_read_entire_dir() Aug 25, 2025
@gaogao-qwq gaogao-qwq force-pushed the recursively-wildcard branch 6 times, most recently from 5f0e4cf to ac1f6e4 Compare August 26, 2025 21:30
…ntire_dir()`

Signed-off-by: gaogao-qwq <gaogaoqwq@gmail.com>
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.

2 participants