Merck / pkglite

Compact Package Representations
https://merck.github.io/pkglite/
GNU General Public License v3.0
30 stars 4 forks source link

Only list files but not folder #7

Closed elong0527 closed 3 years ago

elong0527 commented 3 years ago

Would you think this line of code can be used to list files? Just want to avoid folders

setdiff(list.files(), list.dirs(recursive = FALSE, full.names = FALSE))

https://stackoverflow.com/questions/22069095/r-get-list-of-files-but-not-of-directories

nanxstats commented 3 years ago

Nice! Thanks a lot for spotting this.

For cross-platform compatibility reasons, I would feel safer though with that functional solution using utils::file_test() (https://stackoverflow.com/a/22069867) than with a set operation.

I think we can make this update in the next release.

nanxstats commented 3 years ago

Fixed by https://github.com/Merck/pkglite/commit/b042747f05b742b4ada692c5ecabada29d4f99f8