r-lib/fs

`path_dir()` doesn't understand path expansion with `~` well on Windows

olivroy opened this issue · 0 comments

fs::path_dir("~")
#> "C:/Users/username", should be C:/Users
# using fs::path() doesn't help
fs::path_dir(fs::path("~"))
#> "C:/Users/username", should be C:/Users

A workaround is this (if you know that your file exist.

fs::path_dir(fs::path_real("~"))
#> C:/Users

Cheers

if HOME != FS_HOME