Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make dir_tree() work even when glob or regexp is used
This PR addresses the issue described in r-lib#398. `dir_tree()` didn't work when a pattern was supplied to `regexp=` or `glob=` arguments that get passed on to `dir_ls()`. That's because the list of file paths returned by those calls to `dir_ls()` did not include paths of the parent (and grandparent etc.) directories that `dir_tree()` uses to construct the tree. The code I've added uses the file paths returned by `dir_ls()` to recreate the directory paths that'll be needed to build the tree. To see that this now works, try for example: ```r dir_tree(system.file(package = "fs"), regexp = "[.]rds$") dir_tree(system.file(package = "fs"), type = "directory") ```
- Loading branch information