R/format_path.R

Defines functions open_dir format_path_cli

#' @export

format_path_cli <-
        function(path) {

                path <- path.expand(path)
                path <- gsub(" ", "\\ ", path)
                path <- gsub("|", "\\|", path, fixed = TRUE)
                path <- gsub("-", "\\-", path, fixed = TRUE)

                path
        }


#' @export

open_dir <-
        function(dir) {
                dir <- format_path_cli(path = dir)
                system(paste(Sys.getenv("R_BROWSER"), dir))
        }
patelm9/cave documentation built on March 29, 2021, 6:28 p.m.