diff options
author | Björn Gustavsson <[email protected]> | 2015-11-27 16:06:41 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2015-12-16 15:52:26 +0100 |
commit | ea2481f1fdec3ce9f510201130eca51ab553fa71 (patch) | |
tree | 33c0a81a9162b070189ab85a2b174454ec32ce87 /erts/preloaded | |
parent | 07c69ccb45b5d39493cdc830ee78fe3ec0f3d973 (diff) | |
download | otp-ea2481f1fdec3ce9f510201130eca51ab553fa71.tar.gz otp-ea2481f1fdec3ce9f510201130eca51ab553fa71.tar.bz2 otp-ea2481f1fdec3ce9f510201130eca51ab553fa71.zip |
erl_prim_loader: Avoid making absolute paths
We don't need absolute paths unless we are dealing with archives.
Since it is not free to turn a relative path absolute (we will need a
call to prim_file to fetch the current directory), it's better to
delay the call to absname/1 until we are sure it's needed.
Diffstat (limited to 'erts/preloaded')
-rw-r--r-- | erts/preloaded/src/erl_prim_loader.erl | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/erts/preloaded/src/erl_prim_loader.erl b/erts/preloaded/src/erl_prim_loader.erl index dbb658c904..91ef2bd6d0 100644 --- a/erts/preloaded/src/erl_prim_loader.erl +++ b/erts/preloaded/src/erl_prim_loader.erl @@ -1202,11 +1202,7 @@ path_join([Path],Acc) -> path_join([Path|Paths],Acc) -> path_join(Paths,"/" ++ reverse(Path) ++ Acc). -name_split(ArchiveFile, File0) -> - File = absname(File0), - do_name_split(ArchiveFile, File). - -do_name_split(undefined, File) -> +name_split(undefined, File) -> %% Ignore primary archive RevExt = reverse(init:archive_extension()), case archive_split(File, RevExt, []) of @@ -1215,12 +1211,13 @@ do_name_split(undefined, File) -> Archive -> Archive end; -do_name_split(ArchiveFile, File) -> +name_split(ArchiveFile, File0) -> %% Look first in primary archive + File = absname(File0), case string_match(real_path(File), ArchiveFile, []) of no_match -> %% Archive or plain file - do_name_split(undefined, File); + name_split(undefined, File); {match, _RevPrimArchiveFile, FileInArchive} -> %% Primary archive {archive, ArchiveFile, FileInArchive} @@ -1240,7 +1237,7 @@ archive_split("/"++File, RevExt, Acc) -> false -> archive_split(File, RevExt, [$/|Acc]); true -> - ArchiveFile = reverse(Acc), + ArchiveFile = absname(reverse(Acc)), {archive, ArchiveFile, File} end; archive_split([H|T], RevExt, Acc) -> @@ -1250,7 +1247,7 @@ archive_split([], RevExt, Acc) -> false -> no_split; true -> - ArchiveFile = reverse(Acc), + ArchiveFile = absname(reverse(Acc)), {archive, ArchiveFile, []} end. |