diff --git a/R/fit.R b/R/fit.R index 50ff905a..3580c602 100644 --- a/R/fit.R +++ b/R/fit.R @@ -342,8 +342,7 @@ init_model_methods <- function(seed = 0, verbose = FALSE, hessian = FALSE, force require_suggested_package("Rcpp") require_suggested_package("RcppEigen") if (length(private$model_methods_env_$hpp_code_) == 0 && - (is.null(private$model_methods_env_$obj_file_) || - !file.exists(private$model_methods_env_$obj_file_))) { + !file.exists(private$model_methods_env_$obj_file_)) { stop("Model methods cannot be used with a pre-compiled Stan executable, ", "the model must be compiled again", call. = FALSE) } diff --git a/R/model.R b/R/model.R index 41fc7d19..e82e5b12 100644 --- a/R/model.R +++ b/R/model.R @@ -712,10 +712,7 @@ compile <- function(quiet = TRUE, file.remove(exe) } file.copy(tmp_exe, exe, overwrite = TRUE) - model_obj_file <- paste0(temp_file_no_ext, ".o") - if (file.exists(model_obj_file)) { - private$model_methods_env_$obj_file_ <- model_obj_file - } + private$model_methods_env_$obj_file_ <- paste0(temp_file_no_ext, ".o") if (os_is_wsl()) { res <- processx::run( command = "wsl", diff --git a/R/utils.R b/R/utils.R index 74c21fd6..061bdaa5 100644 --- a/R/utils.R +++ b/R/utils.R @@ -802,7 +802,7 @@ expose_model_methods <- function(env, force_recompile = FALSE, verbose = FALSE) file.copy(model_methods_cpp, source_file, overwrite = FALSE) model_obj_file <- env$obj_file_ - if (is.null(model_obj_file) || !file.exists(model_obj_file)) { + if (!file.exists(model_obj_file)) { if (rlang::is_interactive()) { message("Model object file not found, recompiling model...") }