AW: file:list_dir/1 cannot lists dot(.) and dot-dot(..) directories

[email protected]
Newsgroups gmane.comp.lang.erlang.general
Message-ID <[email protected]>
Maybe there is a philosophical reason:
A process always has a current directory (maybe except some zombies).
It is a bit like "cogito, ergo sum.". If you accept this, then it is a trivial fact that you have to be somewhere,
the short form of which is ".". There is no more reason to state it every time.
".." is a similar item. Every directory has a parent (well, nearly every directory), 
so there is also no need to include that in the results.

More important is that one can use these shortcuts in functions like file:list_dir()/1.
Dieter

Am Di., Jun. 29, 2021 06:11 schrieb Yao Bao :
Hello,

I'm trying to list all files in a directory, then I found file:list_dir/1, it works fine but dot(.) and dot-dot(..) is missing.

I would expect the result from file:list_dir/1 in Erlang is the same as readdir(dirp) in C.

Is there any (historical) reason why these two special directories missing from the return?

Cheers,
Yao
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.