From de623fd54ac9aec3d3260fb66698afd3709a2ba6 Mon Sep 17 00:00:00 2001 From: Alex Suraci Date: Sun, 29 Nov 2009 12:08:57 -0500 Subject: Fix c:nc to use outdir or cwd to find compiled object file Before this patch, c:nc would naively assume the object file was created in the same location as the .erl file. This is often false, for example when an outdir is specified (often the case in make:all([netload])) or calling with c:nc("foo/bar") (because compile:file places bar.beam in the cwd, not foo/). [ Squashed in minor style changes. /bg ] --- lib/stdlib/src/c.erl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/stdlib/src/c.erl') diff --git a/lib/stdlib/src/c.erl b/lib/stdlib/src/c.erl index 9e4cec5db2..433833e233 100644 --- a/lib/stdlib/src/c.erl +++ b/lib/stdlib/src/c.erl @@ -197,7 +197,9 @@ nc(File, Opts0) when is_list(Opts0) -> Opts = Opts0 ++ [report_errors, report_warnings], case compile:file(File, Opts) of {ok,Mod} -> - Fname = concat([File, code:objfile_extension()]), + Dir = outdir(Opts), + Obj = filename:basename(File, ".erl") ++ code:objfile_extension(), + Fname = filename:join(Dir, Obj), case file:read_file(Fname) of {ok,Bin} -> rpc:eval_everywhere(code,load_binary,[Mod,Fname,Bin]), -- cgit v1.2.3