aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2018-01-15 12:28:31 +0100
committerHans Bolinder <[email protected]>2018-01-15 12:28:31 +0100
commit39dbc655f6aa2a971019feccefa3a27273305091 (patch)
tree974dfb1b09f466f5b3718e2b17e3f86682e36e7b /lib/stdlib/src
parent6770fa479205c7eb468cb854ae087859b6603bcd (diff)
parent36b19c153fba7c41ab1da9c9e8bc6e685da1fd95 (diff)
downloadotp-39dbc655f6aa2a971019feccefa3a27273305091.tar.gz
otp-39dbc655f6aa2a971019feccefa3a27273305091.tar.bz2
otp-39dbc655f6aa2a971019feccefa3a27273305091.zip
Merge branch 'hasse/stdlib/find_src/OTP-14832/ERL-527' into maint
* hasse/stdlib/find_src/OTP-14832/ERL-527: stdlib: Correct a filelib test case stdlib: Let filelib:find_source() search subdirs
Diffstat (limited to 'lib/stdlib/src')
-rw-r--r--lib/stdlib/src/filelib.erl21
1 files changed, 14 insertions, 7 deletions
diff --git a/lib/stdlib/src/filelib.erl b/lib/stdlib/src/filelib.erl
index d7c313f214..a9c055f72d 100644
--- a/lib/stdlib/src/filelib.erl
+++ b/lib/stdlib/src/filelib.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1997-2017. All Rights Reserved.
+%% Copyright Ericsson AB 1997-2018. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -544,17 +544,16 @@ default_search_rules() ->
{"", ".c", c_source_search_rules()},
{"", ".in", basic_source_search_rules()},
%% plain old directory rules, backwards compatible
- {"", ""},
- {"ebin","src"},
- {"ebin","esrc"}
- ].
+ {"", ""}] ++ erl_source_search_rules().
basic_source_search_rules() ->
(erl_source_search_rules()
++ c_source_search_rules()).
erl_source_search_rules() ->
- [{"ebin","src"}, {"ebin","esrc"}].
+ [{"ebin","src"}, {"ebin","esrc"},
+ {"ebin",filename:join("src", "*")},
+ {"ebin",filename:join("esrc", "*")}].
c_source_search_rules() ->
[{"priv","c_src"}, {"priv","src"}, {"bin","c_src"}, {"bin","src"}, {"", "src"}].
@@ -634,8 +633,16 @@ try_dir_rule(Dir, Filename, From, To) ->
Src = filename:join(NewDir, Filename),
case is_regular(Src) of
true -> {ok, Src};
- false -> error
+ false -> find_regular_file(wildcard(Src))
end;
false ->
error
end.
+
+find_regular_file([]) ->
+ error;
+find_regular_file([File|Files]) ->
+ case is_regular(File) of
+ true -> {ok, File};
+ false -> find_regular_file(Files)
+ end.