Skip to content

Commit 2659720

Browse files
committed
Quoting only non-standard paths on linux
1 parent ae258f6 commit 2659720

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-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: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,19 @@ 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, quoteAll = .Platform$OS.type!="unix") {
25+
quoted <- shQuote(path)
26+
if (quoteAll) {
27+
quoted
28+
} else {
29+
# Select paths in which all characters do not need quoting
30+
sel <- grepl("^[[:alnum:]/._~+@%-]*$", path)
31+
# Quote remaining paths
32+
ifelse(sel, path, quoted)
33+
}
34+
}
35+
2336
## Use R's internal knowledge of path settings to find the lib/ directory
2437
## plus optinally an arch-specific directory on system building multi-arch
2538
RcppLdPath <- function() {
@@ -51,7 +64,7 @@ RcppCxxFlags <- function(cxx0x=FALSE) {
5164
if (.Platform$OS.type=="windows") {
5265
path <- asBuildPath(path) # #nocov
5366
}
54-
paste0('-I"', path, '"')
67+
paste0('-I', Rcpp.quoteNonStandard(path))
5568
}
5669

5770
## 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)