Bug 16576

Summary: file.copy: copying a file to a directory using overwrite = FALSE does not copy the file (expected) but returns TRUE (expected FALSE instead)
Product: R Reporter: roman.pahl
Component: I/OAssignee: R-core <R-core>
Status: RESOLVED FIXED    
Severity: minor CC: murdoch
Priority: P5    
Version: R 3.2.2   
Hardware: ix86 (32-bit)   
OS: Windows 32-bit   

Description roman.pahl 2015-10-22 14:05:26 UTC
# R version 3.2.2 (2015-08-14) on a i386-w64-mingw32            


fn <- "file.txt"
file.create(fn)
## [1] TRUE

dir.create("some_dir")
file.copy(from = fn, to = "some_dir")
## [1] TRUE

file.copy(from = fn, to = "some_dir", overwrite = FALSE)
## [1] TRUE  # !!!unexpected - expected FALSE!!!

# Specifying the full path works as expected
file.copy(from = fn, to = file.path("some_dir", fn), overwrite = FALSE)
## [1] FALSE
Comment 1 Duncan Murdoch 2015-12-14 14:40:32 UTC
I've fixed this; soon to be committed in R-devel and R-patched.