R/expand_path.R

#' Expand Tilde Path
#'
#' A wrapper for \code{\link[base]{path.expand}} that expands a tilde prefixed
#' path, replacing the leading tilde by the user's home directory (if defined on
#' that platform).
#'
#' @param x A tilde prefixed path.
#' @return Returns a vector of expanded paths.
#' @export
#' @seealso \code{\link[base]{file.path}}
#' @examples
#' library(magrittr)
#' file_path("~/mydir", paste0("file", 1:2, ".pdf")) %>%
#'     expand_path()
expand_path <- function(x){
    class_manipulate(manipulate_parsed(parse_path(path.expand(x))), TRUE)
}
trinker/pathr documentation built on May 31, 2019, 9:41 p.m.