11 #ifndef __FS_Traverse__
12 #define __FS_Traverse__
22 template <
bool DIR,
typename T>
36 if (!func.dir(fullpath.
buffer(), stats[i]))
41 if (!func.file(fullpath.
buffer(), stats[i]))
72 bool sort_contents=
false,
73 bool directories_first=
true)
80 func.file(path, stat);
90 if (fullpath.
last() !=
'/')
99 if (info.
getContents(files, &dirs, &stats, &dir_stats))
107 if (directories_first)
109 if (!process<true, T>(func, fullpath, olen, dirs, dir_stats))
112 if (!process<false, T>(func, fullpath, olen, files, stats))
114 if (!directories_first)
116 if (!process<true, T>(func, fullpath, olen, dirs, dir_stats))
SYS_FORCE_INLINE exint length() const
bool getIsDirectory() const
Returns if the path is a directory.
void sort(bool forward, bool numbered)
GLsizei const GLchar *const * path
SYS_FORCE_INLINE const char * buffer() const
SYS_FORCE_INLINE void strcpy(const char *src)
SYS_FORCE_INLINE char last() const
static bool statFile(const char *source, const char *filename, FS_Stat *fstat)
bool getContents(UT_StringArray &contents, UT_StringArray *dirs=0, UT_Array< FS_Stat > *stats=0, UT_Array< FS_Stat > *dir_stats=0)
void traverse(T &func, const char *path, bool sort_contents=false, bool directories_first=true)
SYS_FORCE_INLINE void truncate(exint new_length)
Helper class for encapsulating file information.
SYS_FORCE_INLINE bool UTisstring(const char *s)
SYS_FORCE_INLINE void append(char character)
bool process(T &func, UT_WorkBuffer &fullpath, exint fullpath_len, const UT_StringArray &paths, const UT_Array< FS_Stat > &stats)
Utility function to process the contents of the traverse() function.
Class for retrieving file information.