From 6bbac0c47b1cb718ee98fd95acb4a2c69b85924f Mon Sep 17 00:00:00 2001 From: Sean Taylor Date: Mon, 2 Mar 2020 13:19:50 -0800 Subject: [PATCH] Store compiled model in platform specific location --- R/R/prophet.R | 6 +++++- R/R/zzz.R | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/R/R/prophet.R b/R/R/prophet.R index 0d14053..efde877 100644 --- a/R/R/prophet.R +++ b/R/R/prophet.R @@ -248,7 +248,11 @@ compile_stan_model <- function() { '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) packageStartupMessage(paste('Writing model to:', dest)) diff --git a/R/R/zzz.R b/R/R/zzz.R index b8c32f5..f500968 100644 --- a/R/R/zzz.R +++ b/R/R/zzz.R @@ -7,8 +7,13 @@ # Create environment for storing stan model assign("prophet_model_env", new.env(), parent.env(environment())) tryCatch({ + if (.Platform$OS.type == "windows") { + dest <- file.path('libs', .Platform$r_arch) + } else { + dest <- 'libs' + } binary <- system.file( - 'libs', + dest, 'prophet_stan_model.RData', package = 'prophet', mustWork = TRUE