filename:dirname(".").

Ulf Wiger (AL/EAB) <>
Fri Oct 1 17:49:38 CEST 2004


Ok, I accept that.

On my Solaris box, basename and dirname are synonymous.
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 ++ "/.".

It would then follow that e.g.:


Eshell V5.4  (abort with ^G)
1> cd("/home/etxuwig").
/home/etxuwig
ok
2> filename:dirname(filename:basename(".")).
"/home/etxuwig"

This would not break any expected analogy with libc, since
in filename.erl, basename/1 and dirname/1 clearly are _not_
synonymous.

It would also not break any documented feature, since it 
is not clear from the filename manual how it is expected
to behave for ".".

/Uffe

> -----Original Message-----
> From: Miguel Barreiro [mailto:]
> Sent: den 1 oktober 2004 14:22
> To: Ulf Wiger (AL/EAB)
> Subject: Re: filename:dirname(".").
> 
> 
> 
> > Shouldn't filename:dirname(".") return either "..", or the same as
> > filename:dirname(filename:absname("."))?
> 
> If filename:dirname/1 is expected to be consistent with the UNIX libc
> dirname (according to Single Unix Specification v2), the 
> current behaviour
> is correct. See man 3 dirname. The GNU libc manpage for 
> dirname even cites
> the "." example.
> 
> Regards,
> 
> Miguel
> 



More information about the erlang-questions mailing list