diff options
| author | Edward Thomson <ethomson@microsoft.com> | 2015-04-29 11:05:27 -0400 |
|---|---|---|
| committer | Edward Thomson <ethomson@microsoft.com> | 2015-05-01 12:31:05 -0400 |
| commit | edbfc52cdd8657371c53070c5e09b58e004bb67a (patch) | |
| tree | 08e658ddc002071357397647aa5fa4453e56fe39 /src/path.h | |
| parent | 544139f50bd7471a62135b29b6a1a2f7c64a1a1c (diff) | |
| download | libgit2-edbfc52cdd8657371c53070c5e09b58e004bb67a.tar.gz | |
git_path: introduce 'git_path_diriter'
Introduce a new `git_path_diriter` that can iterate directories
efficiently for each platform.
Diffstat (limited to 'src/path.h')
| -rw-r--r-- | src/path.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/path.h b/src/path.h index 440b5420c..3a25d4aed 100644 --- a/src/path.h +++ b/src/path.h @@ -273,6 +273,7 @@ extern int git_path_apply_relative(git_buf *target, const char *relpath); enum { GIT_PATH_DIR_IGNORE_CASE = (1u << 0), GIT_PATH_DIR_PRECOMPOSE_UNICODE = (1u << 1), + GIT_PATH_DIR_INCLUDE_DOT_AND_DOTDOT = (1u << 2), }; /** @@ -326,6 +327,37 @@ extern int git_path_walk_up( int (*callback)(void *payload, const char *path), void *payload); +typedef struct git_path_diriter git_path_diriter; + +struct git_path_diriter +{ + git_buf path; + size_t parent_len; + + unsigned int flags; + + DIR *dir; +}; + +extern int git_path_diriter_init( + git_path_diriter *diriter, + const char *path, + unsigned int flags); + +extern int git_path_diriter_next( + const char **out, + size_t *out_len, + git_path_diriter *diriter); + +extern int git_path_diriter_fullpath( + const char **out, + size_t *out_len, + git_path_diriter *diriter); + +extern int git_path_diriter_stat(struct stat *out, git_path_diriter *diriter); + +extern void git_path_diriter_free(git_path_diriter *diriter); + /** * Load all directory entries (except '.' and '..') into a vector. * |
