filename:dirname(".").

Ulf Wiger (AL/EAB) ulf.wiger@REDACTED
Mon Oct 4 13:43:31 CEST 2004


My mistake -- I meant that absname and dirname
are synonymous... which they aren't (absname doesn't
exist in my Solaris box). I must plead temporary insanity,
but point out that this should strenghten my case, if 
anything (not the insanity, but rather the fact that even
if compatibility with libc's dirname might be an issue,
no such issue exists with filename:absname/1.)

IOW, your debugging of my suggestion was successful, 
and this is indeed what I tried to propose.  (:

Rephrased after s/base/dir:

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

/Uffe

> -----Original Message-----
> From: Per Hedeland [mailto:hedeland@REDACTED]
> Sent: den 4 oktober 2004 12:34
> To: erlang-questions@REDACTED; Ulf Wiger (AL/EAB)
> Subject: RE: filename:dirname(".").
> 
> 
> "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
> bar
> $ dirname /foo/bar
> /foo
> 
> 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