fs
fs copied to clipboard
`path_ext` wrong when two dots present
Two dots before file extension break path_ext:
path_ext("file..ext")
# [1] ""
Also when more than 2 dots...
library(fs)
test <- c("abc.xyz", "abc..xyz", "abc...xyz")
path_ext(test)
#> [1] "xyz" "" ""
Created on 2023-01-31 with reprex v2.0.2
Session info
sessionInfo()
#> R version 4.2.2 Patched (2022-11-10 r83330)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Linux Mint 21.1
#>
#> Matrix products: default
#> BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0
#> LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0
#>
#> locale:
#> [1] LC_CTYPE=fr_FR.UTF-8 LC_NUMERIC=C
#> [3] LC_TIME=fr_FR.UTF-8 LC_COLLATE=fr_FR.UTF-8
#> [5] LC_MONETARY=fr_FR.UTF-8 LC_MESSAGES=fr_FR.UTF-8
#> [7] LC_PAPER=fr_FR.UTF-8 LC_NAME=C
#> [9] LC_ADDRESS=C LC_TELEPHONE=C
#> [11] LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] fs_1.6.0
#>
#> loaded via a namespace (and not attached):
#> [1] digest_0.6.31 withr_2.5.0 lifecycle_1.0.3 reprex_2.0.2
#> [5] evaluate_0.20 rlang_1.0.6 cli_3.6.0 rstudioapi_0.14
#> [9] rmarkdown_2.20 tools_4.2.2 glue_1.6.2 xfun_0.36
#> [13] yaml_2.3.7 fastmap_1.1.0 compiler_4.2.2 htmltools_0.5.4
#> [17] knitr_1.42
Encountered this in the wild with filenames in the format - "Surname + initial", e.g. for John Smith,
Smith, J..csv