diff options
author | Björn Gustavsson <[email protected]> | 2016-03-24 15:45:50 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2016-03-24 15:45:50 +0100 |
commit | 443dd5970f321f427b5fd65fcb3f630741a4197f (patch) | |
tree | 353766fcd9ff20211553c79ac66bc4460614bf21 /lib/compiler/src/compile.erl | |
parent | ab418313123e98d5de15e2e71ac169afdad8d3f8 (diff) | |
parent | afff8b0fd74fda09ba8dc5f7bfe95b5cb345872e (diff) | |
download | otp-443dd5970f321f427b5fd65fcb3f630741a4197f.tar.gz otp-443dd5970f321f427b5fd65fcb3f630741a4197f.tar.bz2 otp-443dd5970f321f427b5fd65fcb3f630741a4197f.zip |
Merge branch 'bjorn/compiler/forms/ERL-113/OTP-13430'
* bjorn/compiler/forms/ERL-113/OTP-13430:
Fix compile:forms/1,2 crash when not in an existing directory
Diffstat (limited to 'lib/compiler/src/compile.erl')
-rw-r--r-- | lib/compiler/src/compile.erl | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/compiler/src/compile.erl b/lib/compiler/src/compile.erl index 332bc0bdf9..65566df025 100644 --- a/lib/compiler/src/compile.erl +++ b/lib/compiler/src/compile.erl @@ -1328,7 +1328,7 @@ save_core_code(St) -> beam_asm(#compile{ifile=File,code=Code0, abstract_code=Abst,mod_options=Opts0}=St) -> - Source = filename:absname(File), + Source = paranoid_absname(File), Opts1 = lists:map(fun({debug_info_key,_}) -> {debug_info_key,'********'}; (Other) -> Other end, Opts0), @@ -1337,6 +1337,16 @@ beam_asm(#compile{ifile=File,code=Code0, {ok,Code} -> {ok,St#compile{code=Code,abstract_code=[]}} end. +paranoid_absname(""=File) -> + File; +paranoid_absname(File) -> + case file:get_cwd() of + {ok,Cwd} -> + filename:absname(File, Cwd); + _ -> + File + end. + test_native(#compile{options=Opts}) -> %% This test is done late, in case some other option has turned off native. %% 'native' given on the command line can be overridden by |