From d8fc17044916b0a805efeda60d373930670a390b Mon Sep 17 00:00:00 2001 From: Marco Colombo Date: Tue, 19 Nov 2024 22:18:31 +0100 Subject: [PATCH] Retrieve the package name from the DESCRIPTION file. --- R/rstan_config.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/R/rstan_config.R b/R/rstan_config.R index d697eb3..0b436df 100644 --- a/R/rstan_config.R +++ b/R/rstan_config.R @@ -214,11 +214,12 @@ rstan_config <- function(pkgdir = ".") { eigen_incl <- ifelse(utils::packageVersion('StanHeaders') >= "2.31", "#include ", "#include ") + pkgname <- gsub("Package: ", "", readLines("DESCRIPTION", n = 1)) cat("#include ", eigen_incl, "#include ", file = file.path(pkgdir, "src", - paste(basename(pkgdir), "types.h", sep = "_")), + paste(pkgname, "types.h", sep = "_")), sep = "\n") } else { # actual Stan model