From simon.urbanek at r-project.org  Fri Sep 18 19:41:58 2009
From: simon.urbanek at r-project.org (Simon Urbanek)
Date: Fri, 18 Sep 2009 13:41:58 -0400
Subject: [Rd] basename returns "." not in filename (PR#13958)
In-Reply-To: <4AB3B147.80601@biostat.ku.dk>
References: <20090918141511.30E4A282EF4E@mail.pubhealth.ku.dk>
	<4AB3B147.80601@biostat.ku.dk>
Message-ID: <69C8D027-4B85-4B84-85FD-3F93B0CA99BD@r-project.org>


On Sep 18, 2009, at 12:11 , Peter Dalgaard wrote:

> joehl at web.de wrote:
>> Full_Name: Jens Oehlschl?gel
>> Version: 2.9.2
>> OS: Win32
>> Submission from: (NULL) (85.181.152.156)
>>
>>
>> # Obviously an empty basename is allowed (if the filepath is a pure  
>> path)
>>> basename("/")
>> [1] ""
>>
>> # but here we get the dot from the path
>>> basename("./")
>> [1] "."
>
> Command line utility does likewise:
>
> viggo:~/>basename ./
> .
>
> Point is, I gather, that trailing slashes are removed, e.g.,
>
> viggo:~/>basename foo/
> foo
>
> So, not a bug.
>

Indeed. The rationale is that foo/bar/ specifies a directory "bar" at  
the path "/foo", hence the name is "bar" ("" would make no sense of  
course).

Cheers,
Simon



[Rd] basename returns "." not in filename (PR#13958)
Simon Urbanek