[Rd] Trailing "/" makes file.exists() return FALSE (PR#1098)

hb@maths.lth.se hb@maths.lth.se
Mon, 24 Sep 2001 10:46:29 +0200 (MET DST)


Full_Name: Henrik Bengtsson
Version: 1.3.1
OS: WinMe
Submission from: (NULL) (130.235.2.229)


I found the following bug on WinMe (I call it a bug, since the behavior is
different on WinMe than for instance Sun Solaris):

When calling file.exists() with an existing directory name ending with a "/"
(slash) [R] on WinMe will return FALSE, but when doing the same without the
ending "/" it will give TRUE.

I made a quick work around, but this should be taken care of in the native
code:

file.exists <- function(...) {
  # Remove trailing "/", but keep "C:/", "D:/"...
  files <- gsub("\:/$", "\://", c(...));
  files <- gsub("/$", "", files);
  .Internal(file.exists(files));
}


platform i386-pc-mingw32
arch     x86
os       Win32
system   x86, Win32
status
major    1
minor    3.1
year     2001
month    08
day      31
language R


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._