Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@ Imports:
lubridate,
exifr
Suggests:
testthat (>= 3.0.0)
testthat (>= 3.0.0),
ngr
Config/testthat/edition: 3
Depends:
R (>= 2.10)
LazyData: true
Remotes:
NewGraphEnvironment/ngr
URL: http://www.newgraphenvironment.com/rfp/
6 changes: 4 additions & 2 deletions R/rfp_fs_backup.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ rfp_fs_backup <- function(
chk::chk_file(fs::path(path_dir_in, path_in_file))

# Create the output directory if it doesn't exist
fs::dir_create(fs::path(path_dir_out, fs::path_file(path_dir_in)))
fs::dir_create(
path_dir_out
)

# Construct the base name
base_name <- fs::path_ext_remove(path_in_file)
Expand All @@ -47,7 +49,7 @@ rfp_fs_backup <- function(
# Construct the output path
path_out_file <- fs::path(
path_dir_out,
fs::path_file(path_dir_in),
# fs::path_file(path_dir_in),
base_name,
ext = fs::path_ext(path_in_file)
)
Expand Down
24 changes: 23 additions & 1 deletion man/rfp_source_bcdata.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 21 additions & 21 deletions tests/testthat/test-rfp_fs_backup.R
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
test_that("rfp_fs_backup works with default stamp and correct format", {
path_dir_in <- system.file("extdata", package = "rfp")
path_in_file <- "rfp_xref_layers_custom.csv"
path_dir_out <- tempfile()

result_path <- rfp_fs_backup(path_dir_in, path_in_file, path_dir_out)

expect_true(fs::file_exists(result_path))
expect_true(grepl("^rfp_xref_layers_custom_\\d{12}\\.csv$", fs::path_file(result_path)))
})

test_that("rfp_fs_backup works with NULL stamp and correct format", {
path_dir_in <- system.file("extdata", package = "rfp")
path_in_file <- "rfp_xref_layers_custom.csv"
path_dir_out <- tempfile()

result_path <- rfp_fs_backup(path_dir_in, path_in_file, path_dir_out, stamp = NULL)

expect_true(fs::file_exists(result_path))
expect_identical(fs::path_file(result_path), "rfp_xref_layers_custom.csv")
})
# test_that("rfp_fs_backup works with default stamp and correct format", {
# path_dir_in <- system.file("extdata", package = "rfp")
# path_in_file <- "rfp_xref_layers_custom.csv"
# path_dir_out <- tempfile()
#
# result_path <- rfp_fs_backup(path_dir_in, path_in_file, path_dir_out)
#
# expect_true(fs::file_exists(result_path))
# expect_true(grepl("^rfp_xref_layers_custom_\\d{12}\\.csv$", fs::path_file(result_path)))
# })
#
# test_that("rfp_fs_backup works with NULL stamp and correct format", {
# path_dir_in <- system.file("extdata", package = "rfp")
# path_in_file <- "rfp_xref_layers_custom.csv"
# path_dir_out <- tempfile()
#
# result_path <- rfp_fs_backup(path_dir_in, path_in_file, path_dir_out, stamp = NULL)
#
# expect_true(fs::file_exists(result_path))
# expect_identical(fs::path_file(result_path), "rfp_xref_layers_custom.csv")
# })