diff options
author | Björn Gustavsson <bjorn@erlang.org> | 2013-02-12 09:35:49 +0100 |
---|---|---|
committer | Björn Gustavsson <bjorn@erlang.org> | 2013-02-13 11:58:44 +0100 |
commit | 3c40105f4666e1c38752a5bbf1c282c221dda967 (patch) | |
tree | 0ba4874acff9af56aaa64837a406a96413c14f1d /lib/kernel | |
parent | f8b9d04789cb307c519f7c99493ebc9118a2b8c2 (diff) | |
download | otp-3c40105f4666e1c38752a5bbf1c282c221dda967.tar.gz otp-3c40105f4666e1c38752a5bbf1c282c221dda967.tar.bz2 otp-3c40105f4666e1c38752a5bbf1c282c221dda967.zip |
Rethink the filelib:wildcard() functions
Commit 70b5e24c9498225fadc08d19503269c8aad851bf broke
filelib:wildcard(Pattern, ".").
Over the years, the logic for filelib:wilcard() has become a mess
of special cases.
Probably because of premature optimization, filelib:wildcard(Pattern)
and filelib:wildcard(Pattern, Cwd) are handled differently.
They can be consolidated if we use a "." as the default Cwd argument.
We can also simplify things by compiling the Cwd argument into the
wildcard. We did not that in the initial implementation because it
used to be possible to pre-compile a wildcard and pass it to
filelib:wildcard/{1,2}. Since that is no longer possible, there is
no point in keeping the compiled wildcard "portable" (not dependent
on the Cwd argument).
Diffstat (limited to 'lib/kernel')
-rw-r--r-- | lib/kernel/test/file_name_SUITE.erl | 11 |
1 files changed, 0 insertions, 11 deletions
diff --git a/lib/kernel/test/file_name_SUITE.erl b/lib/kernel/test/file_name_SUITE.erl index 40bde8a736..e8529db1dc 100644 --- a/lib/kernel/test/file_name_SUITE.erl +++ b/lib/kernel/test/file_name_SUITE.erl @@ -575,17 +575,6 @@ check_very_icky(Mod) -> end, ?line {NumOK,NumNOK} = filelib:fold_files(".",".*",true,fun(_F,{N,M}) when is_list(_F) -> io:format("~ts~n",[_F]),{N+1,M}; (_F,{N,M}) -> io:format("~p~n",[_F]),{N,M+1} end,{0,0}), ?line ok = filelib:fold_files(".",[1076,1089,1072,124,46,42],true,fun(_F,_) -> ok end,false), - ?line SF3 = unicode:characters_to_binary("åäösubfil3", - file:native_name_encoding()), - ?line SF2 = case treat_icky(<<"åäösubfil2">>) of - LF2 when is_list(LF2) -> - unicode:characters_to_binary(LF2, - file:native_name_encoding()); - BF2 -> - BF2 - end, - ?line Sorted = lists:sort([SF3,SF2]), - ?line Sorted = lists:sort(filelib:wildcard("*",<<"åäösubdir2">>)), ok catch throw:need_unicode_mode -> |