From 5e9d05198cd00f74b99f697eb022ae0b2f31f136 Mon Sep 17 00:00:00 2001 From: Sam Bobroff Date: Tue, 18 May 2010 11:49:08 +1000 Subject: Change make:files to behave more like erlc Currently make:files will fail with the atom 'error' and no message when the input (.erl) file is unreadable or the output (.beam) file is unwritable. This differs from erlc which will print a useful error message, or when possible, remove the unwritable output file and continue successfully. This change removes the unnecessary checks on the files when make:files is called and allows the error checking to be done in compile:file, where the error messages are produced. It does not affect the return value. In particular this resolves the mysterious problem of make:files failing but erlc succeeding, caused by an unwritable (usually root owned) beam file in an otherwise writable build directory. --- lib/tools/src/make.erl | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/lib/tools/src/make.erl b/lib/tools/src/make.erl index 77c354651b..e78e2a43a4 100644 --- a/lib/tools/src/make.erl +++ b/lib/tools/src/make.erl @@ -222,12 +222,7 @@ recompilep(File, NoExec, Load, Opts) -> recompilep1(File, NoExec, Load, Opts, ObjFile) -> {ok, Erl} = file:read_file_info(lists:append(File, ".erl")), {ok, Obj} = file:read_file_info(ObjFile), - case {readable(Erl), writable(Obj)} of - {true, true} -> - recompilep1(Erl, Obj, File, NoExec, Load, Opts); - _ -> - error - end. + recompilep1(Erl, Obj, File, NoExec, Load, Opts). recompilep1(#file_info{mtime=Te}, #file_info{mtime=To}, File, NoExec, Load, Opts) when Te>To -> @@ -277,14 +272,6 @@ exists(File) -> false end. -readable(#file_info{access=read_write}) -> true; -readable(#file_info{access=read}) -> true; -readable(_) -> false. - -writable(#file_info{access=read_write}) -> true; -writable(#file_info{access=write}) -> true; -writable(_) -> false. - coerce_2_list(X) when is_atom(X) -> atom_to_list(X); coerce_2_list(X) -> -- cgit v1.2.3