Skip to content

Commit

Permalink
Fix compile_dir
Browse files Browse the repository at this point in the history
  • Loading branch information
Evan Miller committed Jan 17, 2012
1 parent 3330835 commit 6e36de6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
23 changes: 14 additions & 9 deletions src/erlydtl_compiler.erl
Expand Up @@ -118,17 +118,22 @@ compile_dir(Dir, Module, Options) ->
Context = init_dtl_context_dir(Dir, Module, Options),
Files = filelib:fold_files(Dir, ".*", true, fun(F1,Acc1) -> [F1 | Acc1] end, []),
{ParserResults, ParserErrors} = lists:foldl(fun
("."++_, Acc) -> Acc;
(File, {ResultAcc, ErrorAcc}) ->
FilePath = filename:join([Dir, File]),
case filelib:is_dir(FilePath) of
true ->
case filename:basename(File) of
"."++_ ->
{ResultAcc, ErrorAcc};
false ->
case parse(FilePath, Context) of
ok -> {ResultAcc, ErrorAcc};
{ok, DjangoParseTree, CheckSum} -> {[{File, DjangoParseTree, CheckSum}|ResultAcc], ErrorAcc};
Err -> {ResultAcc, [Err|ErrorAcc]}
_ ->
FilePath = filename:absname(File),
case filelib:is_dir(FilePath) of
true ->
{ResultAcc, ErrorAcc};
false ->
case parse(FilePath, Context) of
ok -> {ResultAcc, ErrorAcc};
{ok, DjangoParseTree, CheckSum} ->
{[{File, DjangoParseTree, CheckSum}|ResultAcc], ErrorAcc};
Err -> {ResultAcc, [Err|ErrorAcc]}
end
end
end
end, {[], []}, Files),
Expand Down
2 changes: 1 addition & 1 deletion src/erlydtl_runtime.erl
Expand Up @@ -174,7 +174,7 @@ stringify_final([El | Rest], Out, BinaryStrings) ->
init_counter_stats(List) ->
init_counter_stats(List, undefined).

init_counter_stats(List, Parent) ->
init_counter_stats(List, Parent) when is_list(List) ->
[{counter, 1},
{counter0, 0},
{revcounter, length(List)},
Expand Down

0 comments on commit 6e36de6

Please sign in to comment.