Skip to content

Commit

Permalink
Quoting only non-standard paths on linux
Browse files Browse the repository at this point in the history
  • Loading branch information
llaniewski committed Jan 24, 2023
1 parent ae258f6 commit 2659720
Show file tree
Hide file tree
Showing 3 changed files with 28 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
15 changes: 14 additions & 1 deletion R/RcppLdpath.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,19 @@ 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, quoteAll = .Platform$OS.type!="unix") {
quoted <- shQuote(path)
if (quoteAll) {
quoted
} else {
# Select paths in which all characters do not need quoting
sel <- grepl("^[[:alnum:]/._~+@%-]*$", path)
# Quote remaining paths
ifelse(sel, path, quoted)
}
}

## 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 +64,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 2659720

Please sign in to comment.