Skip to content

basename returns "." not in filename (PR#13958)

3 messages · Jens Oehlschlägel, Peter Dalgaard, Simon Urbanek

#
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)
[1] ""

# but here we get the dot from the path
[1] "."
_                           
platform       i386-pc-mingw32             
arch           i386                        
os             mingw32                     
system         i386, mingw32               
status                                     
major          2                           
minor          9.2                         
year           2009                        
month          08                          
day            24                          
svn rev        49384                       
language       R                           
version.string R version 2.9.2 (2009-08-24)
#
joehl at web.de wrote:
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.
#
On Sep 18, 2009, at 12:11 , Peter Dalgaard wrote:

            
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