-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathget_path.R
24 lines (23 loc) · 943 Bytes
/
get_path.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#' Get the full path of a file in the \code{inst/extdata} folder
#' @param filename the file's name, without the path
#' @return the full path to the filename. Will \code{stop} if the file
#' is absent in the \code{inst/extdata} folder
#' @seealso for more files, use \code{\link{get_beastier_paths}}
#' @author Richèl J.C. Bilderbeek
#' @examples
#' library(testthat)
#'
#' expect_true(is.character(get_beastier_path("beast2_example_output.log")))
#' expect_true(is.character(get_beastier_path("beast2_example_output.trees")))
#' expect_true(is.character(get_beastier_path("beast2_example_output.xml")))
#' expect_true(
#' is.character(get_beastier_path("beast2_example_output.xml.state"))
#' )
#' @export
get_beastier_path <- function(filename) {
full <- system.file("extdata", filename, package = "beastier")
if (!file.exists(full)) {
stop("'filename' must be the name of a file in 'inst/extdata'")
}
full
}