diff --git a/R/utils.R b/R/utils.R index b99c8fc..ea59dd5 100644 --- a/R/utils.R +++ b/R/utils.R @@ -29,6 +29,10 @@ lilypond_version <- function(){ #' @rdname lilypond_root #' @export tabr_lilypond_api <- function(){ + message(.tabr_lilypond_api()) +} + +.tabr_lilypond_api <- function(){ os <- Sys.info()[["sysname"]] if(grepl("Darwin", os, ignore.case = TRUE)) os <- "MacOS" x <- switch( @@ -39,11 +43,10 @@ tabr_lilypond_api <- function(){ ) x <- paste("LilyPond", x) - msg <- paste0( + paste0( "The tabr ", getNamespaceVersion("tabr"), " LilyPond API was built and tested against ", x, " on ", os, "." ) - message(msg) } .tabr_api_lp_versions <- list( diff --git a/R/zzz.R b/R/zzz.R index 1467aa2..4aa7d89 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -1,4 +1,4 @@ -.onAttach <- function(lib, pkg){ +.onLoad <- function(lib, pkg){ x <- c("lilypond", "midi2ly", "python") lp_path <- as.character(Sys.which(x[1])) ml_path <- as.character(Sys.which(x[2])) @@ -15,10 +15,13 @@ } tabr_options(lilypond = lp_path, midi2ly = ml_path, python = py_path) +} - msg <- paste0(utils::capture.output(tabr_lilypond_api(), type = "message"), "\n") - +.onAttach <- function(lib, pkg){ + lp_path <- tabr_options()$lilypond + msg <- paste0(.tabr_lilypond_api(), "\n") no_lp <- gsub("\\.$", " (only required for transcription).", .lp_not_found) + if(lp_path == ""){ msg <- paste0(msg, no_lp) } else {