knitr::opts_knit$set(root.dir = rprojroot::find_rstudio_root_file()) # Set WD to Root
here::i_am("dev/fs-test.Rmd")
library(fs)
library(here)
library(dplyr)
path_chr <- c("thai.tex", 
              "thai.zip.tex", 
              "./thai.tex", 
              "../thai.tex", 
              "out/thai.tex",
              "/Users/kittipos/my_pkg", 
              "~/my_pkg")
fs::path_abs(fs::path_ext_remove(path_chr))
fs::path_ext_remove(path_chr) %>% 
  fs::path_abs() %>% 
  fs::path(ext = "other")
fs::path_ext_remove(path_chr) %>% 
  fs::path(ext = "other") %>% 
  fs::path_abs() 
fs::path(fs::path_abs(fs::path_ext_remove(path_chr)), ext = "tex")

fs::path(fs::path_ext_remove(path_chr), ext = "tex")

Test path_*

Path Abs (best)

fs::path_abs(path_chr)

Path WD

fs::path_wd(path_chr) # Will fail some of these

Path File (Good)

path_file(path_chr)

Remove Ext

fs::path_ext_remove(path_chr)

Note that 2 extension will remove the first one



Lightbridge-KS/thaipdf documentation built on June 18, 2022, 6:58 a.m.