R/file_dir.R

Defines functions file_dir

Documented in file_dir

#' Parent directory of current file
#' @importFrom rstudioapi  getSourceEditorContext
#' @export
file_dir = function(){

  if(rstudioapi::isAvailable()){
    path_folder = paste0(strsplit(rstudioapi::getSourceEditorContext()$path[[1]], "/")[[1]] %>% .[1:length(.) -
                                                                                                    1],
                         collapse = "/")
    return(path_folder)
  }else{

   this.dir = this.path::this.dir()
   return(this.dir)

  }

}
MaThRk/help documentation built on Dec. 17, 2021, 2:14 a.m.