diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2023-04-21 23:02:32 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2023-04-29 00:26:32 +0200 |
commit | 1b832b6dfb8d9da2b94f07ccc95c03614b378786 (patch) | |
tree | 953d52de8ccf3573f6cf68740c64d017623578d9 /include | |
parent | 9caccbfec112c53133aff09119eda623ae0644fe (diff) |
libutil: Add a stacked, recursive directory tree iterator
The concept is simple: Use the existing, platform dependent iterator
to walk a directory. If a directory entry is encountered, recurse into
it using the open_subdir handler, reconstruct the full path for any
entries discovered using the directory stack.
An additional function is added to skip a sub-hierarchy.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include')
-rw-r--r-- | include/util/dir_tree_iterator.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/util/dir_tree_iterator.h b/include/util/dir_tree_iterator.h new file mode 100644 index 0000000..953459f --- /dev/null +++ b/include/util/dir_tree_iterator.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: LGPL-3.0-or-later */ +/* + * dir_tree_iterator.h + * + * Copyright (C) 2023 David Oberhollenzer <goliath@infraroot.at> + */ +#ifndef UTIL_DIR_TREE_ITERATOR_H +#define UTIL_DIR_TREE_ITERATOR_H + +#include "util/dir_iterator.h" + +dir_iterator_t *dir_tree_iterator_create(const char *path); + +void dir_tree_iterator_skip(dir_iterator_t *it); + +#endif /* UTIL_DIR_TREE_ITERATOR_H */ |