[erlang-questions] filelib:is_file/1 seems to be wrong on my machine

Torben Hoffmann <>
Mon Apr 16 23:46:40 CEST 2012



On 16/4/12 23:30 , Tuncer Ayaz wrote:
> On Mon, Apr 16, 2012 at 11:27 PM, Torben Hoffmann wrote:
>> 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.
> Use filelib:is_regular/1 for files.
I obviously should be at sleep instead of coding... :-$

One should read the text in the manual and not just the headlines!

Thanks!!
Torben

-- 
http://www.linkedin.com/in/torbenhoffmann




More information about the erlang-questions mailing list