Skip to content

Commit

Permalink
use fastrls if installed instead of fs::dir_ls when building cache
Browse files Browse the repository at this point in the history
  • Loading branch information
raymondben committed Jul 8, 2024
1 parent 43b835a commit db85941
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
21 changes: 9 additions & 12 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
Package: raadfiles
Title: File Database Management for 'raadtools'
Version: 0.1.4.9007
Authors@R: c(
person("Michael D.","Sumner", role = c("aut", "cre"), email = "[email protected]"),
person("Ben", "Raymond", role = "ctb"),
person(given = "Kimberlee",
family = "Baldry",
role = c("ctb"),
comment = c(ORCID = "0000-0003-3286-8624"))
)
Description: Tools for managing collections of files for the 'raad' family.
Version: 0.1.4.9008
Authors@R: c(person("Michael D.","Sumner", role = c("aut", "cre"), email = "[email protected]"),
person("Ben", "Raymond", role = "ctb"),
person("Kimberlee", "Baldry", role = c("ctb"), comment = c(ORCID = "0000-0003-3286-8624")))
Description: Tools for managing collections of files for the 'raad' family.
Depends:
R (>= 3.3.0)
Imports:
Expand All @@ -24,5 +19,7 @@ Imports:
License: GPL-3
Encoding: UTF-8
RoxygenNote: 7.2.3
Suggests: testthat
Remotes: r-lib/fs
Suggests:
fastrls,
testthat
Remotes: r-lib/fs, AustralianAntarcticDivision/fastrls
13 changes: 8 additions & 5 deletions R/000-raadfiles-admin.R
Original file line number Diff line number Diff line change
Expand Up @@ -332,16 +332,19 @@ run_build_raad_cache <- function() {
adminpath <- dirname(raad_filedb_path(roots[i]))
dir.create(adminpath, showWarnings = FALSE)
dbpath <- raad_filedb_path(roots[i])
filenames <- as.character(fs::dir_ls(roots[i], all = TRUE, recurse = TRUE,
## no directory, FIFO, socket, character_device or block_device
type = c("file", "symlink")))
if (is.null(filenames)) {
if (requireNamespace("fastrls", quietly = TRUE)) {
filenames <- as.character(fastrls::fastrls(roots[i], include_dirs = FALSE, n_threads = 4))
} else {
filenames <- as.character(fs::dir_ls(roots[i], all = TRUE, recurse = TRUE,
## no directory, FIFO, socket, character_device or block_device
type = c("file", "symlink")))
}
if (is.null(filenames) || length(filenames) < 1) {
files <- tibble::tibble(root = character(0), file = character(0))

} else {
## fix up root-less file
filenames <- remove_leading_slash(gsub(roots[i], "", filenames))

files <- tibble::tibble(root = roots[i], file = filenames)

}
Expand Down

0 comments on commit db85941

Please sign in to comment.