[Rd] file.exists does not like path names ending in /

William Dunlap wdunlap at tibco.com
Fri Jan 17 19:35:18 CET 2014


> I think that ignoring a terminal slash/backslash on Windows would do no
> harm:

Windows makes a distinction between "C:" and "C:/": the former is
not a file (or directory) and the latter is.

Bill Dunlap
TIBCO Software
wdunlap tibco.com


> -----Original Message-----
> From: r-devel-bounces at r-project.org [mailto:r-devel-bounces at r-project.org] On Behalf
> Of Kirill Müller
> Sent: Friday, January 17, 2014 9:26 AM
> To: r-devel at r-project.org
> Subject: Re: [Rd] file.exists does not like path names ending in /
> 
> On 01/17/2014 02:56 PM, Gabor Grothendieck wrote:
> > At the moment I am using this to avoid the
> > problem:
> >
> > File.exists <- function(x) {
> >     if (.Platform$OS == "windows" && grepl("[/\\]$", x)) {
> >         file.exists(dirname(x))
> >     } else file.exists(x)
> > }
> >
> > but it would be nice if that could be done by file.exists itself.
> I think that ignoring a terminal slash/backslash on Windows would do no
> harm: It would improve consistency between platforms, and perhaps nobody
> really relies on the current behavior. Would shorten the documentation, too.
> 
> 
> -Kirill
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list