Fix file existence checks

This commit is contained in:
Tuncer Ayaz 2011-01-07 16:32:36 +01:00
parent a8870807fc
commit 58fd80917a
5 changed files with 5 additions and 5 deletions

View file

@ -174,7 +174,7 @@ referenced_dtls1(Step, Config, Seen) ->
end, Step)), end, Step)),
DocRoot = option(doc_root, DtlOpts), DocRoot = option(doc_root, DtlOpts),
WithPaths = [ filename:join([DocRoot, F]) || F <- AllRefs ], WithPaths = [ filename:join([DocRoot, F]) || F <- AllRefs ],
Existing = [F || F <- WithPaths, filelib:is_file(F)], Existing = [F || F <- WithPaths, filelib:is_regular(F)],
New = sets:subtract(sets:from_list(Existing), Seen), New = sets:subtract(sets:from_list(Existing), Seen),
case sets:size(New) of case sets:size(New) of
0 -> Seen; 0 -> Seen;

View file

@ -195,7 +195,7 @@ is_quickcheck_avail() ->
{error, bad_name} -> {error, bad_name} ->
IsAvail = false; IsAvail = false;
Dir -> Dir ->
IsAvail = filelib:is_file(filename:join(Dir, "eqc.hrl")) IsAvail = filelib:is_regular(filename:join(Dir, "eqc.hrl"))
end, end,
erlang:put(is_quickcheck_avail, IsAvail), erlang:put(is_quickcheck_avail, IsAvail),
?DEBUG("Quickcheck availability: ~p\n", [IsAvail]), ?DEBUG("Quickcheck availability: ~p\n", [IsAvail]),

View file

@ -133,7 +133,7 @@ referenced_pegs1(Step, Config, Seen) ->
end, Step)), end, Step)),
DocRoot = option(doc_root, NeoOpts), DocRoot = option(doc_root, NeoOpts),
WithPaths = [ filename:join([DocRoot, F]) || F <- AllRefs ], WithPaths = [ filename:join([DocRoot, F]) || F <- AllRefs ],
Existing = [F || F <- WithPaths, filelib:is_file(F)], Existing = [F || F <- WithPaths, filelib:is_regular(F)],
New = sets:subtract(sets:from_list(Existing), Seen), New = sets:subtract(sets:from_list(Existing), Seen),
case sets:size(New) of case sets:size(New) of
0 -> Seen; 0 -> Seen;

View file

@ -33,7 +33,7 @@ is_rel_dir() ->
is_rel_dir(Dir) -> is_rel_dir(Dir) ->
Fname = filename:join([Dir, "reltool.config"]), Fname = filename:join([Dir, "reltool.config"]),
case filelib:is_file(Fname) of case filelib:is_regular(Fname) of
true -> true ->
{true, Fname}; {true, Fname};
false -> false ->

View file

@ -259,7 +259,7 @@ render(Bin, Context) ->
write_file(Output, Data, Force) -> write_file(Output, Data, Force) ->
%% determine if the target file already exists %% determine if the target file already exists
FileExists = filelib:is_file(Output), FileExists = filelib:is_regular(Output),
%% perform the function if we're allowed, %% perform the function if we're allowed,
%% otherwise just process the next template %% otherwise just process the next template