File 2213-Clean-up-processing-of-archive-files.patch of Package erlang

From 73bc045aa5b432f6ed34475ae7a1d5fa6566a9dd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Wed, 27 Apr 2016 16:57:27 +0200
Subject: [PATCH 3/9] 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.
---
 lib/kernel/src/code_server.erl | 18 ++----------------
 1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/lib/kernel/src/code_server.erl b/lib/kernel/src/code_server.erl
index 02fc043..5fd434e 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;
-- 
2.1.4

openSUSE Build Service is sponsored by