Per Hedeland hedeland@REDACTED
Mon Oct 4 12:33:59 CEST 2004

"Ulf Wiger (AL/EAB)" <ulf.wiger@REDACTED> wrote:
>On my Solaris box, basename and dirname are synonymous.

Surely not:

$ uname -sr
SunOS 5.8
$ basename /foo/bar
$ dirname /foo/bar

Perhaps you mean that theye are synonymous when the argument is "." - if
so, yes, that follows from their definition.

>I'd like to suggest then that filename:dirname(".") stays as is,
>but that filename:basename(".") be changed to return the 
>parent directory rather than ParentDir ++ "/.".

Hm, I assume you mean absname here, not basename? Otherwise s/dir/base/
on Miguel's message... The dirname and basename functions are purely
syntactical operations.

For absname this change seems reasonable, especially since absname
already does remove "intermediate" occurrences of ".". There are some
instances where "/foo/bar" and "/foo/bar/." can mean different things
though (notably if "bar" is a symlink pointing to a directory). And you
could use filename:absname("") instead...

--Per Hedeland

More information about the erlang-questions mailing list