aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-04-27 16:57:27 +0200
committerBjörn Gustavsson <[email protected]>2016-04-29 09:58:27 +0200
commit73bc045aa5b432f6ed34475ae7a1d5fa6566a9dd (patch)
tree9d3c49471756760b111bc9b28ca66ca50ca976a8 /lib/kernel
parent27098673c0654add1784852b54d4600a2775773e (diff)
downloadotp-73bc045aa5b432f6ed34475ae7a1d5fa6566a9dd.tar.gz
otp-73bc045aa5b432f6ed34475ae7a1d5fa6566a9dd.tar.bz2
otp-73bc045aa5b432f6ed34475ae7a1d5fa6566a9dd.zip
Clean up processing of archive files
The same filtering of sub directories is done in archive_subdirs/1 and try_archive_subdirs/1. Actually, archive_subdirs/1 does nothing useful. It can be removed and all_archive_subdirs/1 can be renamed to archive_subdirs/1. In try_archive_subdirs/1, we can also replace filename:join/1 with the cheaper filename:append/1, since we know that pathnames have already been normalized.
Diffstat (limited to 'lib/kernel')
-rw-r--r--lib/kernel/src/code_server.erl18
1 files changed, 2 insertions, 16 deletions
diff --git a/lib/kernel/src/code_server.erl b/lib/kernel/src/code_server.erl
index 02fc043325..5fd434e323 100644
--- a/lib/kernel/src/code_server.erl
+++ b/lib/kernel/src/code_server.erl
@@ -794,20 +794,6 @@ insert_name(Name, Dir, Db) ->
true.
archive_subdirs(AppDir) ->
- IsDir =
- fun(RelFile) ->
- File = filename:join([AppDir, RelFile]),
- case erl_prim_loader:read_file_info(File) of
- {ok, #file_info{type = directory}} ->
- false;
- _ ->
- true
- end
- end,
- {Base, ArchiveDirs} = all_archive_subdirs(AppDir),
- {Base, lists:filter(IsDir, ArchiveDirs)}.
-
-all_archive_subdirs(AppDir) ->
Ext = archive_extension(),
Base = filename:basename(AppDir),
Dirs =
@@ -821,12 +807,12 @@ all_archive_subdirs(AppDir) ->
try_archive_subdirs(AppDir ++ Ext, Base, Dirs).
try_archive_subdirs(Archive, Base, [Dir | Dirs]) ->
- ArchiveDir = filename:join([Archive, Dir]),
+ ArchiveDir = filename:append(Archive, Dir),
case erl_prim_loader:list_dir(ArchiveDir) of
{ok, Files} ->
IsDir =
fun(RelFile) ->
- File = filename:join([ArchiveDir, RelFile]),
+ File = filename:append(ArchiveDir, RelFile),
case erl_prim_loader:read_file_info(File) of
{ok, #file_info{type = directory}} ->
true;