digideskio / zotonic

Automatically exported from code.google.com/p/zotonic
0 stars 0 forks source link

z_module_indexer: add recursion scan into scan_subdir/4 #163

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
One my projects has 100+ of templates, so they are organized into 2- or 3-level 
directory structure:

/templates/base.tpl
/templates/one_dir/one_template.tpl
/templates/anothen_dir/sub_dir/_other.tpl

The problem is that mod_translation generates template only for 
/templates/*.tpl, so dozens of templates in subdirs is skipped. This caused by 
too-simple wildcard in z_module_indexer:scan_subdir/4:

limitation is near line 295: 
Files = filelib:wildcard(Pattern),
where Pattern is string like "/.../templates/*.tpl" for this case.

One fat crunch (attached) is to use filelib:fold_files/5 with recursion=true:
filelib:fold_files(".../templates", ".*\.tpl", true, fun(F,Acc) -> [F | Acc] 
end, []).

Original issue reported on code.google.com by hellla...@gmail.com on 16 Mar 2011 at 1:45

GoogleCodeExporter commented 8 years ago

Original comment by hellla...@gmail.com on 16 Mar 2011 at 3:38

Attachments:

GoogleCodeExporter commented 8 years ago
This issue was closed by revision 059696af069b.

Original comment by scherpenisse on 24 Mar 2011 at 9:37