The "Path Finder" class is a utility class for searching the filesystem for files matching a set of common prefixes and/or suffixes (i.e.
More...
#include "util.h"
The "Path Finder" class is a utility class for searching the filesystem for files matching a set of common prefixes and/or suffixes (i.e.
directories and file extensions).
Example usage:
int rc;
char const * found = NULL;
if(rc) { ...error... }
if(0==rc){ assert(NULL!=found); }
The "Path Finder" class is a utility class for searching the filesystem for files matching a set of c...
FSL_EXPORT void fsl_pathfinder_clear(fsl_pathfinder *pf)
Frees all memory associated with pf, but does not free pf.
FSL_EXPORT int fsl_pathfinder_dir_add(fsl_pathfinder *pf, char const *dir)
Equivalent to fsl_pathfinder_dir_add2() with -1 as a final argument.
FSL_EXPORT int fsl_pathfinder_search(fsl_pathfinder *pf, char const *base, char const **pOut, fsl_size_t *outLen)
Searches for a file whose name can be constructed by some combination of pf's directory/extension lis...
FSL_EXPORT const fsl_pathfinder fsl_pathfinder_empty
Initialized-with-defaults fsl_pathfinder instance, intended for copy initialization.
FSL_EXPORT int fsl_pathfinder_ext_add(fsl_pathfinder *pf, char const *ext)
Equivalent to fsl_pathfinder_ext_add2() with -1 as a final argument.
- See also
- fsl_pathfinder_dir_add()
-
fsl_pathfinder_ext_add()
-
fsl_pathfinder_clear()
-
fsl_pathfinder_search()
Definition at line 4936 of file util.h.
◆ buf
Used to build up a path string during fsl_pathfinder_search(), and holds the result of a successful search.
We use a buffer, as opposed to a simple string, because (A) it simplifies the search implementation and (B) reduces allocations (it gets reused for each search).
Definition at line 4954 of file util.h.
◆ dirs
Holds the list of search directories.
Each entry is a (char *) owned by this object.
Definition at line 4946 of file util.h.
◆ ext
Holds the list of search extensions.
Each entry is a (char *) owned by this object.
Definition at line 4941 of file util.h.
The documentation for this struct was generated from the following file: