aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src/code.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-01-28 12:24:44 +0100
committerBjörn Gustavsson <[email protected]>2016-01-28 12:24:44 +0100
commitdf5be3657a7eca136632fddd3e11a5cc2d78a1d8 (patch)
treed3bc1b045d6bf131846f1012e7b0b6752861c087 /lib/kernel/src/code.erl
parent6301ceeb265f68b417bb2ce58312e34b9557a294 (diff)
parentd8161c3ad977c0e20c075ecf58d8ac5769637828 (diff)
downloadotp-df5be3657a7eca136632fddd3e11a5cc2d78a1d8.tar.gz
otp-df5be3657a7eca136632fddd3e11a5cc2d78a1d8.tar.bz2
otp-df5be3657a7eca136632fddd3e11a5cc2d78a1d8.zip
Merge branch 'maint'
* maint: Update documentation for code-loading functions code: Correct the types for error returns Eliminate run-time system crash in code:load_abs/1
Diffstat (limited to 'lib/kernel/src/code.erl')
-rw-r--r--lib/kernel/src/code.erl9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/kernel/src/code.erl b/lib/kernel/src/code.erl
index ae28c97b47..a82fc0f3d6 100644
--- a/lib/kernel/src/code.erl
+++ b/lib/kernel/src/code.erl
@@ -79,10 +79,9 @@
%%----------------------------------------------------------------------------
-type load_error_rsn() :: 'badfile'
- | 'native_code'
| 'nofile'
| 'not_purged'
- | 'on_load'
+ | 'on_load_failure'
| 'sticky_directory'.
-type load_ret() :: {'error', What :: load_error_rsn()}
| {'module', Module :: module()}.
@@ -137,14 +136,16 @@ load_file(Mod) when is_atom(Mod) ->
-spec ensure_loaded(Module) -> {module, Module} | {error, What} when
Module :: module(),
- What :: embedded | badfile | native_code | nofile | on_load.
+ What :: embedded | badfile | nofile | on_load_failure.
ensure_loaded(Mod) when is_atom(Mod) ->
call({ensure_loaded,Mod}).
%% XXX File as an atom is allowed only for backwards compatibility.
-spec load_abs(Filename) -> load_ret() when
Filename :: file:filename().
-load_abs(File) when is_list(File); is_atom(File) -> call({load_abs,File,[]}).
+load_abs(File) when is_list(File); is_atom(File) ->
+ Mod = list_to_atom(filename:basename(File)),
+ call({load_abs,File,Mod}).
%% XXX Filename is also an atom(), e.g. 'cover_compiled'
-spec load_abs(Filename :: loaded_filename(), Module :: module()) -> load_ret().