R/utils.R

Defines functions uri resolve_path

resolve_path <- function(path) {
  if (grepl("[a-zA-Z]+://", path)) {
    path
  }
  else {
    dir_path <- path %>%
      normalizePath(mustWork = FALSE, winslash = "/") %>%
      dirname() %>%
      tools::file_path_as_absolute()
    file.path(dir_path, basename(path))
  }
}

uri <- function(path) {
  prefix <- if (.Platform$OS.type == "windows") "file:///" else "file:"
  paste0(prefix, path)
}

#' @importFrom purrr %||%
NULL

Try the mleap package in your browser

Any scripts or data that you put into this service are public.

mleap documentation built on Jan. 28, 2021, 1:09 a.m.