aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src/c.erl
diff options
context:
space:
mode:
authorAlex Suraci <[email protected]>2009-11-29 12:08:57 -0500
committerBjörn Gustavsson <[email protected]>2009-12-14 13:46:29 +0100
commitde623fd54ac9aec3d3260fb66698afd3709a2ba6 (patch)
tree0f158e48d2ce71ed1faab6f2044c00b36242c87c /lib/stdlib/src/c.erl
parent0ad86bc3d062508f78142f2cc1a4756fece24c10 (diff)
downloadotp-de623fd54ac9aec3d3260fb66698afd3709a2ba6.tar.gz
otp-de623fd54ac9aec3d3260fb66698afd3709a2ba6.tar.bz2
otp-de623fd54ac9aec3d3260fb66698afd3709a2ba6.zip
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 ]
Diffstat (limited to 'lib/stdlib/src/c.erl')
-rw-r--r--lib/stdlib/src/c.erl4
1 files changed, 3 insertions, 1 deletions
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]),