Skip to content

Commit d9d551d

Browse files
authored
Merge pull request #1243 from llaniewski/flagsquote
Quoting only non-standard paths on linux
2 parents ae258f6 + 82bcfc0 commit d9d551d

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2023-01-24 Lukasz Laniewski-Wollk <[email protected]>
2+
3+
* R/RcppLdpath.R: CxxFlags() now quotes only non-standard paths on linux
4+
15
2023-01-08 Dirk Eddelbuettel <[email protected]>
26

37
* inst/include/Rcpp/String.h: Address clang++-14 conversion warning

R/RcppLdpath.R

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ Rcpp.system.file <- function(...){
2020
tools::file_path_as_absolute( base::system.file( ..., package = "Rcpp" ) )
2121
}
2222

23+
## quote path if non-standard characters are used
24+
Rcpp.quoteNonStandard <- function(path) {
25+
## On unix, check if path has only characters that do not need quoting
26+
noquote <- .Platform$OS.type == "unix" && grepl("^[[:alnum:]/._~+@%-]*$", path)
27+
## If no quoting needed return unchanged else quote input
28+
if (noquote) path else shQuote(path)
29+
}
30+
2331
## Use R's internal knowledge of path settings to find the lib/ directory
2432
## plus optinally an arch-specific directory on system building multi-arch
2533
RcppLdPath <- function() {
@@ -51,7 +59,7 @@ RcppCxxFlags <- function(cxx0x=FALSE) {
5159
if (.Platform$OS.type=="windows") {
5260
path <- asBuildPath(path) # #nocov
5361
}
54-
paste0('-I"', path, '"')
62+
paste0('-I', Rcpp.quoteNonStandard(path))
5563
}
5664

5765
## Shorter names, and call cat() directly

inst/NEWS.Rd

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@
33
\newcommand{\ghpr}{\href{https://github.com/RcppCore/Rcpp/pull/#1}{##1}}
44
\newcommand{\ghit}{\href{https://github.com/RcppCore/Rcpp/issues/#1}{##1}}
55

6+
\section{Changes in Rcpp hotfix release version 1.0.11 (2023-07-xx)}{
7+
\itemize{
8+
\item Changes in Rcpp API:
9+
\itemize{
10+
\item \code{Rcpp:::CxxFlags()} now quotes only non-standard include path
11+
on linux (closing \ghit{1242}).
12+
}
13+
}
14+
}
15+
616
\section{Changes in Rcpp release version 1.0.10 (2023-01-12)}{
717
\itemize{
818
\item Changes in Rcpp API:

0 commit comments

Comments
 (0)