Skip to content

Commit 203b6ca

Browse files
committed
Update kyber_file to use certificate dir; use kyber_file()
1 parent ab2bd60 commit 203b6ca

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

R/create_certificate.R

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,9 @@ create_certificate <- function(
5353

5454
template <- switch(
5555
cohort_type,
56-
standard = system.file("certificate/certificate.qmd", package = "kyber"),
57-
nmfs = system.file("certificate/certificate-nmfs.qmd", package = "kyber"),
58-
pathways = system.file(
59-
"certificate/certificate-pathways.qmd",
60-
package = "kyber"
61-
)
56+
standard = kyber_file("certificate.qmd"),
57+
nmfs = kyber_file("certificate-nmfs.qmd"),
58+
pathways = kyber_file("certificate-pathways.qmd")
6259
)
6360

6461
participant_name <- paste(first_name, last_name)

R/kyber_file.R

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,25 @@
55
#'
66
#' @param path The name of the file. If no argument is provided then
77
#' all of the example files will be listed.
8-
#'
8+
#'
99
#' @return A vector of file paths
1010
#' @export
1111
#' @examples
1212
#' kyber_file("_opening.Rmd")
1313
#'
14-
kyber_file <- function(path = NULL){
15-
if(is.null(path)) {
14+
kyber_file <- function(path = NULL) {
15+
kyber_inst_dirs <- c(
16+
"agendas",
17+
"kyber-templates",
18+
"ms-word-themes",
19+
"certificate"
20+
)
21+
if (is.null(path)) {
1622
list.files(
17-
system.file(c("agendas", "kyber-templates", "ms-word-themes"),
18-
package = "kyber"), full.names = TRUE)
23+
system.file(kyber_inst_dirs, package = "kyber"),
24+
full.names = TRUE
25+
)
1926
} else {
20-
system.file(c("agendas", "kyber-templates", "ms-word-themes"),
21-
path, package = "kyber", mustWork = TRUE)
27+
system.file(kyber_inst_dirs, path, package = "kyber", mustWork = TRUE)
2228
}
23-
}
29+
}

0 commit comments

Comments
 (0)