Skip to content

Commit

Permalink
Use writeLines, flexible regex for spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
andrjohns committed Mar 3, 2023
1 parent 26f2c2b commit 498536c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/rstan_config.R
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ rstan_config <- function(pkgdir = ".") {
if (grepl("\\.stanfunctions$", file_name) &&
(utils::packageVersion('rstan') < 2.29)) {
mod <- readLines(file_name)
if (!any(grepl("\\bfunctions \\{", mod))) {
cat("functions {", mod, "}", sep = "\n", file = file_name)
if (!any(grepl("\\bfunctions(\\s*|)\\{", mod))) {
writeLines("functions {", mod, "}", sep = "\n", con = file_name)
}
}
stanc_ret <- rstan::stanc(file_name, allow_undefined = TRUE,
Expand Down

0 comments on commit 498536c

Please sign in to comment.