Skip to content

Commit 3aec6f2

Browse files
committed
use a local function instead of trimws which is available only in R (>= 3.2.0)
1 parent 1904df0 commit 3aec6f2

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2015-03-15 Dirk Eddelbuettel <[email protected]>
2+
3+
* R/Attributes.R (.rtoolsPath): Replace trimws() use with a local variant
4+
15
2015-03-11 JJ Allaire <[email protected]>
26

37
* R/Attributes.R: Rtools 3.3 is now located and used for compilation under R 3.2.

R/Attributes.R

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# Copyright (C) 2012 JJ Allaire, Dirk Eddelbuettel and Romain Francois
1+
2+
# Copyright (C) 2012 - 2015 JJ Allaire, Dirk Eddelbuettel and Romain Francois
23
#
34
# This file is part of Rcpp.
45
#
@@ -726,7 +727,9 @@ sourceCppFunction <- function(func, isVoid, dll, symbol) {
726727
# environment variable
727728
.rtoolsPath <- function(path) {
728729
path <- gsub("\\\\", "/", path)
729-
path <- trimws(path)
730+
## R 3.2.0 or later only: path <- trimws(path)
731+
.localsub <- function(re, x) sub(re, "", x, perl = TRUE)
732+
path <- .localsub("[ \t\r\n]+$", .localsub("^[ \t\r\n]+", path))
730733
if (substring(path, nchar(path)) != "/")
731734
path <- paste(path, "/", sep="")
732735
path

0 commit comments

Comments
 (0)