123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- #ifndef __sti__fs_h__
- #define __sti__fs_h__
- #include <stddef.h> // size_t
- #include "macros.h"
- typedef struct rglob_entry {
- char type;
- char* full_path;
- char* file_name;
- } rglob_entry;
- typedef struct rglob {
- char* pattern;
- int len;
- int alloc;
- rglob_entry* entries;
-
- } rglob;
- void recursive_glob(char* base_path, char* pattern, int flags, rglob* results);
- int is_path_a_dir(char* path);
- int is_regular_file(char* path);
- #define path_join(...) path_join_(PP_NARG(__VA_ARGS__), __VA_ARGS__)
- char* path_join_(size_t nargs, ...);
- char* path_ext(char* path);
- char* path_ext2(char* path, int* end);
- char* read_whole_file(char* path, size_t* srcLen);
- char* read_whole_file_extra(char* path, size_t extraAlloc, size_t* srcLen);
- int write_whole_file(char* path, void* data, size_t len);
- char** read_whole_dir(char* path, unsigned int flags, size_t* outLen);
- char** read_whole_dir_abs(char* path, unsigned int flags, size_t* outLen);
- typedef int (*readDirCallbackFn)(char* , char* , void* );
- #define FSU_EXCLUDE_HIDDEN (1<<0)
- #define FSU_NO_FOLLOW_SYMLINKS (1<<1)
- #define FSU_INCLUDE_DIRS (1<<2)
- #define FSU_EXCLUDE_FILES (1<<3)
- #define FSU_DIRS_ONLY (FSU_EXCLUDE_FILES | FSU_INCLUDE_DIRS)
- int recurse_dirs(
- char* path,
- readDirCallbackFn fn,
- void* data,
- int depth,
- unsigned int flags
- );
- char* resolve_path(char* in);
- char** multi_wordexp_dup(char* input, size_t* out_len);
- #ifndef NO_STI_V0_COMPAT
- #define recurseDirs(...) recurse_dirs(__VA_ARGS__)
- #define readWholeFileExtra(...) read_whole_file_extra(__VA_ARGS__)
- #define readWholeFile(...) read_whole_file(__VA_ARGS__)
- #define pathExt(...) path_ext(__VA_ARGS__)
- #define pathExt2(...) path_ext2(__VA_ARGS__)
- #endif
- #endif // __sti__fs_h__
|