|
@@ -221,18 +221,24 @@ compile_one_dtl(File_Path, Path, Ebin_Dir, SourceExt) ->
|
|
|
|
|
|
Opts = dtl_opts(DocRoot, OutDir, SourceExt, ModuleExt),
|
|
|
|
|
|
- ModuleName = module_name(File_Path, SourceExt, ModuleExt),
|
|
|
- BeamName = beam_path_name(OutDir, erlang:atom_to_list(ModuleName)),
|
|
|
+ Module_Name = module_name(File_Path, SourceExt, ModuleExt),
|
|
|
+ Beam_Name = beam_path_name(OutDir, erlang:atom_to_list(Module_Name)),
|
|
|
|
|
|
- case is_compiled(BeamName, File_Path) of
|
|
|
+ case is_compiled(Beam_Name, File_Path) of
|
|
|
false ->
|
|
|
+
|
|
|
+ delete_old_beam(Beam_Name),
|
|
|
+
|
|
|
io:format("~nCompiling ~p: ", [File_Path]),
|
|
|
|
|
|
- case erlydtl:compile(File_Path, ModuleName, Opts) of
|
|
|
+ RZ = erlydtl:compile(File_Path, Module_Name, Opts),
|
|
|
+ %io:format("RZ: ~p~n", [RZ]),
|
|
|
+ case RZ of
|
|
|
{error, Error} ->
|
|
|
io:format("~nError: ~p~n", [Error]);
|
|
|
- _ ->
|
|
|
- file:change_time(BeamName, calendar:local_time()),
|
|
|
+ {ok, Module_Name} ->
|
|
|
+ file:change_time(Beam_Name, calendar:local_time()),
|
|
|
+
|
|
|
io:format("ok~n", [])
|
|
|
end;
|
|
|
_ ->
|
|
@@ -267,4 +273,7 @@ last_modified(File) ->
|
|
|
calendar:datetime_to_gregorian_seconds(N)
|
|
|
end.
|
|
|
|
|
|
+delete_old_beam(File) ->
|
|
|
+ file:delete(File).
|
|
|
+
|
|
|
|