From 57aaf7d0c7c75cfd8c6b55c21d977b695f460022 Mon Sep 17 00:00:00 2001 From: Richard Carlsson Date: Wed, 18 Jan 2017 18:28:47 +0100 Subject: Add filelib:find_file/2/3 and filelib:find_source/1/2/3 This moves, extends and exports functionality that previously existed only internally in filename:find_src/1/2, adding the ability to automatically substitute file suffixes and use different rules for different suffixes. --- lib/stdlib/doc/src/filelib.xml | 54 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) (limited to 'lib/stdlib/doc/src/filelib.xml') diff --git a/lib/stdlib/doc/src/filelib.xml b/lib/stdlib/doc/src/filelib.xml index 7c6380ce28..ad73fc254a 100644 --- a/lib/stdlib/doc/src/filelib.xml +++ b/lib/stdlib/doc/src/filelib.xml @@ -60,6 +60,12 @@ + + + + + + @@ -226,7 +232,51 @@ filelib:wildcard("lib/**/*.{erl,hrl}") directory.

+ + + + + Find a file relative to a given directory. + +

Looks for a file of the given name by applying suffix rules to + the given directory path. For example, a rule {"ebin", "src"} + means that if the directory path ends with "ebin", the + corresponding path ending in "src" should be searched.

+

If Rules is left out or is an empty list, the + default system rules are used. See also the Kernel application + parameter source_search_rules.

+
+
+ + + Find the source file for a given object file. + +

Equivalent to find_source(Base, Dir), where Dir is + filename:dirname(FilePath) and Base is + filename:basename(FilePath).

+
+
+ + + + Find a source file relative to a given directory. + +

Applies file extension specific rules to find the source file for + a given object file relative to the object directory. For example, + for a file with the extension .beam, the default rule is to + look for a file with a corresponding extension .erl by + replacing the suffix "ebin" of the object directory path with + "src". + The file search is done through find_file/3. The directory of + the object file is always tried before any other directory specified + by the rules.

+

If Rules is left out or is an empty list, the + default system rules are used. See also the Kernel application + parameter source_search_rules.

+
+
- - -- cgit v1.2.3