[erlang-questions] filelib:is_file/1 seems to be wrong on my machine
Torben Hoffmann
torben.lehoff@REDACTED
Mon Apr 16 23:27:02 CEST 2012
Output from Erlang shell:
1> {ok, Cs} = file:list_dir(".").
{ok,["TODO.md","test","src","sinan.config",
"rebar.config.bak","README.md","Makefile","LICENSE",
"INSTALL.md","examples","ebin","doc",
"current_counterexample.eqc","config","CHANGELOG.md",
"_build",".gitignore",".git"]}
2> lists:partition( fun file:is_file/1, Cs ).
** exception error: undefined function file:is_file/1
in function lists:partition/4 (lists.erl, line 1236)
3> lists:partition( fun filelib:is_file/1, Cs ).
{["TODO.md","test","src","sinan.config","rebar.config.bak",
"README.md","Makefile","LICENSE","INSTALL.md","examples",
"ebin","doc","current_counterexample.eqc","config",
"CHANGELOG.md","_build",".gitignore",".git"],
[]}
4> lists:partition( fun filelib:is_dir/1, Cs ).
{["test","src","examples","ebin","doc","config","_build",
".git"],
["TODO.md","sinan.config","rebar.config.bak","README.md",
"Makefile","LICENSE","INSTALL.md",
"current_counterexample.eqc","CHANGELOG.md",".gitignore"]}
It seems that filelib:is_file/1 is viewing everything as a file whereas
filelib:is_dir/1 has a more correct view.
Done on my Mac OS X Lion using R15B.
Cheers,
Torben
--
http://www.linkedin.com/in/torbenhoffmann
More information about the erlang-questions
mailing list