[Rcpp-devel] CRLF to LF warning

Dirk Eddelbuettel edd at debian.org
Mon Apr 23 18:53:37 CEST 2012


On 23 April 2012 at 17:36, Marie Auger-Methe wrote:
| Hi,
| 
| I'm a windows user and I'm trying to make a package using 
| Rcpp.package.skeleton.  When I check my package using R CMD check, I get 
| the warning:
| Found the following sources/headers with CR or CRLF line endings:
|    src/rcpp_hello_world.h
| Some Unix compilers require LF line endings.
| 
| I get this warning even when produce a package skeleton using the 
| following code:
| library(Rcpp)
| Rcpp.package.skeleton("m1p")
| 
| I get more files having this issue, including .cpp files when I start 
| editing them with Notepad, Wordpad or RStudio.
| 
| I'm not sure how to fix this problem, I've tried to use the following 
| command in Command Prompt:
| tr -d '\r' < rcpp_hello_world.h >> rcpp_hello_world.h
| 
| But it's not quite working.
| 
| I'm not sure whether I can ignore this warning or not, especially since 
| I will use my package on a Unix machine.

Please do not post "non-Rcpp" questions here. This really is a basic "how do
I work with Unix and Windows without going crazy" question, and those have
been asked and answered a million times.

I once needed a solution in the builds process of an R package [ littler, if
anyone cares ... ] and cooked up this.  Surely not optimal, but it gets the
job done:

-----------------------------------------------------------------------------

## simple 0d 0a -> 0a converter to suppress a warning on Windows

filename <- commandArgs(trailingOnly=TRUE)[1]
if (!file.exists(filename)) q()

con <- file(filename, "rb")
bin <- readBin(con, raw(), 100000)
bin <- bin[ which(bin != "0d") ]
close(con)

Sys.sleep(1)

con <- file(filename, "wb")
writeBin(bin, con)
close(con)
-----------------------------------------------------------------------------

But again, let's try to keep this list focused on Rcpp.

Dirk

-- 
R/Finance 2012 Conference on May 11 and 12, 2012 at UIC in Chicago, IL
See agenda, registration details and more at http://www.RinFinance.com


More information about the Rcpp-devel mailing list