yihui/knitr — Issue #149: file.copy(overwrite=T) in stitch
Author: mnel
Created: 2012-02-24 02:31:57+00:00
State: open

In the function stitch, the template file is copied to the working directory, overwriting if necessary.

```
file.copy(template, ".", overwrite = TRUE)
```

This causes the following if the template is already within the working directory

```
## Error in txtProgressBar(0, n, char = ">", style = 3) :
## must have max > min
```

On my system (Windows XP) , the file.copy command appears to wipe the contents of the file when copying to the same location and overwriting.

perhaps

```
if(!file.exists( template ) ){
file.copy(template, '.', overwrite = T)
}
```

would avoid this issue.