From de0771a4b3d882161f10c1d2d03c8027327f9323 Mon Sep 17 00:00:00 2001 From: Hans Bolinder Date: Thu, 4 Jan 2018 16:54:22 +0100 Subject: stdlib: Let filelib:find_source() search subdirs The Design Principles states that an application can have Erlang source files one level below the "src" directory, and now filelib:find_source() by default searches one level below "src". The same applies to "esrc". That directory is only mentioned in filename(3). --- lib/kernel/doc/src/kernel_app.xml | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'lib/kernel') diff --git a/lib/kernel/doc/src/kernel_app.xml b/lib/kernel/doc/src/kernel_app.xml index e5ac031539..0762cebc94 100644 --- a/lib/kernel/doc/src/kernel_app.xml +++ b/lib/kernel/doc/src/kernel_app.xml @@ -4,7 +4,7 @@
- 19962017 + 19962018 Ericsson AB. All Rights Reserved. @@ -469,8 +469,12 @@ MaxT = TickTime + TickTime / 4 ObjSuffix = string() SrcSuffix = string() -

Specifies a list of rules for use by filelib:find_file/2 and - filelib:find_source/2. If this is set to some other value +

Specifies a list of rules for use by + + filelib:find_file/2 + + filelib:find_source/2 + If this is set to some other value than the empty list, it replaces the default rules. Rules can be simple pairs of directory suffixes, such as {"ebin", "src"}, which are used by filelib:find_file/2, or @@ -478,6 +482,16 @@ MaxT = TickTime + TickTime / 4 file name extensions, for example [{".beam", ".erl", [{"ebin", "src"}]}, which are used by filelib:find_source/2. Both kinds of rules can be mixed in the list.

+

The interpretation of ObjDirSuffix and SrcDirSuffix + is as follows: if the end of the directory name where an + object is located matches ObjDirSuffix, then the + name created by replacing ObjDirSuffix with + SrcDirSuffix is expanded by calling + + filelib:wildcard/1, and the first regular + file found among the matches is the source file. +

+ -- cgit v1.2.3