118 struct dirent* ep = NULL;
119 amxc_string_t filename;
120 size_t path_len = strlen(
path);
121 amxc_string_init(&filename, 128);
127 for(ep = readdir(dp); ep; ep = readdir(dp)) {
128 if(ep->d_name[0] ==
'.') {
131 if(
path[path_len - 1] ==
'/') {
132 amxc_string_setf(&filename,
"%s%s",
path, ep->d_name);
134 amxc_string_setf(&filename,
"%s/%s",
path, ep->d_name);
138 retval = fn(amxc_string_get(&filename, 0), priv);
139 when_failed(retval, exit);
142 if(recursive && (ep->d_type == DT_DIR)) {
143 retval =
amxp_dir_scan_impl(amxc_string_get(&filename, 0), expr, recursive, fn, priv);
144 when_failed(retval, exit);
149 amxc_string_clean(&filename);
static int amxp_dir_scan_impl(const char *path, amxp_expr_t *expr, bool recursive, amxp_dir_match_fn_t fn, void *priv)
static amxp_expr_status_t amxp_expr_dir_get_field(UNUSED amxp_expr_t *expr, amxc_var_t *value, const char *path, void *priv)
bool amxp_expr_evaluate(amxp_expr_t *expr, amxp_expr_get_field_t fn, void *priv, amxp_expr_status_t *status)
Evaluates an expression.
static amxc_string_t path