Add a trailing backlash to a file path if this is a directory. This is useful in messages to the console for example to quickly identify directories from files.
mark_dirs(x)
If x
is a vector of relative paths, directory test is done with path
relative to the current working dir. Use in_dir()
or use absolute
paths.
mark_dirs(list.files(find.package("xfun"), full.names = TRUE))
#> [1] "/tmp/RtmplGg3Jy/temp_libpath39927d15f364fe/xfun/DESCRIPTION"
#> [2] "/tmp/RtmplGg3Jy/temp_libpath39927d15f364fe/xfun/INDEX"
#> [3] "/tmp/RtmplGg3Jy/temp_libpath39927d15f364fe/xfun/LICENSE"
#> [4] "/tmp/RtmplGg3Jy/temp_libpath39927d15f364fe/xfun/Meta/"
#> [5] "/tmp/RtmplGg3Jy/temp_libpath39927d15f364fe/xfun/NAMESPACE"
#> [6] "/tmp/RtmplGg3Jy/temp_libpath39927d15f364fe/xfun/NEWS.md"
#> [7] "/tmp/RtmplGg3Jy/temp_libpath39927d15f364fe/xfun/R/"
#> [8] "/tmp/RtmplGg3Jy/temp_libpath39927d15f364fe/xfun/help/"
#> [9] "/tmp/RtmplGg3Jy/temp_libpath39927d15f364fe/xfun/html/"
#> [10] "/tmp/RtmplGg3Jy/temp_libpath39927d15f364fe/xfun/libs/"
#> [11] "/tmp/RtmplGg3Jy/temp_libpath39927d15f364fe/xfun/resources/"
#> [12] "/tmp/RtmplGg3Jy/temp_libpath39927d15f364fe/xfun/scripts/"