Created attachment 2005 [details]
When the filename argument of a png device with type = "cairo-png" contains a leading tilde, R fails to produce an output file with the expanded filename.
How to reproduce:
png("~/A.png", type = "cairo")
png("~/B.png", type = "cairo-png")
After these commands, "A.png" is found in the home directory, but there is no "B.png" (unless it already existed). I don't know if the second set of plotting commands created a file in some unexpected location or if no file was produced.
The expected result is to find both "A.png" and "B.png" in the home directory.
Tested on R-devel and R 3.2.3 patched, both of revision 69967.
Using the patch attached, the result from R-devel is as expected.
R Under development (unstable) (2016-01-21 r69967)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.3 LTS
 LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
 LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
 LC_PAPER=en_US.UTF-8 LC_NAME=C
 LC_ADDRESS=C LC_TELEPHONE=C
 LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
 stats graphics grDevices utils datasets methods base