Skip to content

Commit

Permalink
Merge pull request #1243 from llaniewski/flagsquote
Browse files Browse the repository at this point in the history
Quoting only non-standard paths on linux
  • Loading branch information
eddelbuettel committed Jan 24, 2023
2 parents ae258f6 + 82bcfc0 commit d9d551d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2023-01-24 Lukasz Laniewski-Wollk <llaniewski@meil.pw.edu.pl>

* R/RcppLdpath.R: CxxFlags() now quotes only non-standard paths on linux

2023-01-08 Dirk Eddelbuettel <edd@debian.org>

* inst/include/Rcpp/String.h: Address clang++-14 conversion warning
Expand Down
10 changes: 9 additions & 1 deletion R/RcppLdpath.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ Rcpp.system.file <- function(...){
tools::file_path_as_absolute( base::system.file( ..., package = "Rcpp" ) )
}

## quote path if non-standard characters are used
Rcpp.quoteNonStandard <- function(path) {
## On unix, check if path has only characters that do not need quoting
noquote <- .Platform$OS.type == "unix" && grepl("^[[:alnum:]/._~+@%-]*$", path)
## If no quoting needed return unchanged else quote input
if (noquote) path else shQuote(path)
}

## Use R's internal knowledge of path settings to find the lib/ directory
## plus optinally an arch-specific directory on system building multi-arch
RcppLdPath <- function() {
Expand Down Expand Up @@ -51,7 +59,7 @@ RcppCxxFlags <- function(cxx0x=FALSE) {
if (.Platform$OS.type=="windows") {
path <- asBuildPath(path) # #nocov
}
paste0('-I"', path, '"')
paste0('-I', Rcpp.quoteNonStandard(path))
}

## Shorter names, and call cat() directly
Expand Down
10 changes: 10 additions & 0 deletions inst/NEWS.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
\newcommand{\ghpr}{\href{https://github.com/RcppCore/Rcpp/pull/#1}{##1}}
\newcommand{\ghit}{\href{https://github.com/RcppCore/Rcpp/issues/#1}{##1}}

\section{Changes in Rcpp hotfix release version 1.0.11 (2023-07-xx)}{
\itemize{
\item Changes in Rcpp API:
\itemize{
\item \code{Rcpp:::CxxFlags()} now quotes only non-standard include path
on linux (closing \ghit{1242}).
}
}
}

\section{Changes in Rcpp release version 1.0.10 (2023-01-12)}{
\itemize{
\item Changes in Rcpp API:
Expand Down

0 comments on commit d9d551d

Please sign in to comment.