Store compiled model in platform specific location

This commit is contained in:
Sean Taylor 2020-03-02 13:19:50 -08:00
parent 192b9160a7
commit 6bbac0c47b
2 changed files with 11 additions and 2 deletions

View file

@ -248,7 +248,11 @@ compile_stan_model <- function() {
'You should not see this message more than once after install.' 'You should not see this message more than once after install.'
) )
dest <- file.path(path.package("prophet"), 'libs') if (.Platform$OS.type == "windows") {
dest <- file.path(path.package("prophet"), 'libs', .Platform$r_arch)
} else {
dest <- file.path(path.package("prophet"), 'libs')
}
dir.create(dest, recursive = TRUE, showWarnings = FALSE) dir.create(dest, recursive = TRUE, showWarnings = FALSE)
packageStartupMessage(paste('Writing model to:', dest)) packageStartupMessage(paste('Writing model to:', dest))

View file

@ -7,8 +7,13 @@
# Create environment for storing stan model # Create environment for storing stan model
assign("prophet_model_env", new.env(), parent.env(environment())) assign("prophet_model_env", new.env(), parent.env(environment()))
tryCatch({ tryCatch({
if (.Platform$OS.type == "windows") {
dest <- file.path('libs', .Platform$r_arch)
} else {
dest <- 'libs'
}
binary <- system.file( binary <- system.file(
'libs', dest,
'prophet_stan_model.RData', 'prophet_stan_model.RData',
package = 'prophet', package = 'prophet',
mustWork = TRUE mustWork = TRUE