basename returns "." not in filename (PR#13958)
Jens,
On Sep 18, 2009, at 15:08 , Jens Oehlschl=E4gel wrote:
Mmh,
Point is, I gather, that trailing slashes are removed, e.g., viggo:~/>basename foo/ foo So, not a bug.
This unfortunately means that we cannot distinguish between 1) a path with a filename 2) a path without a filename
Of course you can - but that's unrelated to the bug report.
For example in the next version of the ff-package we allow a user to =20=
specify a 'pattern' for all files of a ff dataframe which is path =20 together with a fileprefix, the above means we cannot specify an =20 empty prefix "" for the current working directory, because
dirname("./.")
[1] "."
basename("./.")
[1] "."
dirname("./")
[1] "."
basename("./")
[1] "."
I don't see the connection - I would suggest you read the IEEE Std =20 1003.1-2001 which defines the behavior of basename (and the R =20 documentation for basename clearly states the behavior as well). The =20= fact that you are trying to use the wrong tool for your purpose =20 doesn't mean that the tool is broken. I would advise you to ask on R-=20 help how to implement your pattern specification (just FWIW it's non-=20 standard and requirement of trailing slashes does lead to very nasty =20 problems for the user). Cheers, Simon