From 5c02bdb5c43f68528f08305b51dba3dbed7489fc Mon Sep 17 00:00:00 2001 From: Kyle Barrett Date: Thu, 8 Feb 2024 15:37:42 -0500 Subject: [PATCH] fix print method and add handling for .mod extensions --- R/print.R | 2 +- R/run-nmtran.R | 6 ++++++ man/print_bbi.Rd | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/R/print.R b/R/print.R index 439e4a93d..8fa05e204 100644 --- a/R/print.R +++ b/R/print.R @@ -284,7 +284,7 @@ print.bbi_nonmem_summary <- function(x, .digits = 3, .fixed = FALSE, .off_diag = #' @describeIn print_bbi Prints the `NMTRAN` evaluation of a `bbi_model` model #' @export -print.nmtran_process <- function(x){ +print.nmtran_process <- function(x, ...){ is_valid_print <- function(.x) { if (!is.null(.x)) { diff --git a/R/run-nmtran.R b/R/run-nmtran.R index 4d4e85e66..34013bf21 100644 --- a/R/run-nmtran.R +++ b/R/run-nmtran.R @@ -180,6 +180,12 @@ get_data_path_from_ctl <- function(.mod){ # Get data record data_rec <- nmrec::select_records(ctl, "data")[[1]] data_path <- nmrec::get_record_option(data_rec, "filename")$value + + # Handling for `.mod` extensions + if(grepl("(?i)mod", fs::path_ext(mod_path))){ + data_path <- file.path("..", data_path) + } + data_path_norm <- fs::path_norm(file.path(mod_path, data_path)) if(!fs::file_exists(data_path_norm)){ diff --git a/man/print_bbi.Rd b/man/print_bbi.Rd index 614c56d23..3fb2753c1 100644 --- a/man/print_bbi.Rd +++ b/man/print_bbi.Rd @@ -14,7 +14,7 @@ \method{print}{bbi_nonmem_summary}(x, .digits = 3, .fixed = FALSE, .off_diag = FALSE, .nrow = NULL, ...) -\method{print}{nmtran_process}(x) +\method{print}{nmtran_process}(x, ...) } \arguments{ \item{x}{Object to format or print.}