File: find_template_file.R

package info (click to toggle)
r-cran-future.batchtools 0.12.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 528 kB
  • sloc: sh: 82; makefile: 2
file content (14 lines) | stat: -rw-r--r-- 491 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#' @importFrom batchtools findTemplateFile
#' @importFrom utils file_test
find_template_file <- function(template) {
  pathname <- findTemplateFile(template)
  if (is.na(pathname)) {
    pathname <- system.file("templates", sprintf("%s.tmpl", template),
                            package = .packageName)
    if (!file_test("-f", pathname)) pathname <- NA_character_
  }
  if (is.na(pathname)) {
    stopf("Failed to locate a batchtools template file: *%s.tmpl", template)
  }
  pathname
}