[Rd] basename returns "." not in filename (PR#13958)
(Ted Harding)
Ted.Harding at manchester.ac.uk
Fri Sep 18 23:35:37 CEST 2009
On 18-Sep-09 19:08:15, Jens Oehlschlägel 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
>
> For example in the next version of the ff-package we allow a user to
> specify a 'pattern' for all files of a ff dataframe which is path
> together with a fileprefix, the above means we cannot specify an empty
> prefix "" for the current working directory, because
>
>> dirname("./.")
> [1] "."
>> basename("./.")
> [1] "."
>> dirname("./")
> [1] "."
>> basename("./")
> [1] "."
>
> Jens Oehlschlägel
I am getting confused by this discussion. At least on Unixoid systems,
and I believe it holds for Windows systems too, "." stands for the
current directory ("working directory").
Moreover, "./" means exactly the same as ".": If you list the files
in "./" you will get exactly the same as if you list the files in ".".
Further, "<any directory>/." means the same as "<any directory>/"
and the same as "<any directory>", so (on the same basis) "./." also
means exactly the same as ".".
Therefore the second "." in "./." is not a filename.
What the above examples of dirname and basename usage are returning
is simply a specific representation of the current working directlory.
Forgive me if I have not seen the point, but what I think I have seen
boils down to the interpretation I have given above.
Best wishes,
Ted.
--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 18-Sep-09 Time: 22:35:34
------------------------------ XFMail ------------------------------
More information about the R-devel
mailing list