Skip to content

Commit

Permalink
similar refactor for named files
Browse files Browse the repository at this point in the history
  • Loading branch information
ijlyttle committed Feb 3, 2024
1 parent 735e03d commit 0fa48a2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions R/boxr_save_load.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
box_save <- function(..., dir_id = box_getwd(), file_name = ".RData",
description = NULL) {

# using local_tempdir() to preserve the filename
temp_file <- fs::path(withr::local_tempdir(), file_name)

Check warning on line 35 in R/boxr_save_load.R

View check run for this annotation

Codecov / codecov/patch

R/boxr_save_load.R#L35

Added line #L35 was not covered by tests

save(..., envir = parent.frame(), file = temp_file)
Expand Down Expand Up @@ -58,8 +59,7 @@ box_save_image <- function(dir_id = box_getwd(), file_name = ".RData",
}

# using local_tempdir() to preserve the filename
temp_dir <- withr::local_tempdir()
temp_file <- fs::path(temp_dir, file_name)
temp_file <- fs::path(withr::local_tempdir(), file_name)

Check warning on line 62 in R/boxr_save_load.R

View check run for this annotation

Codecov / codecov/patch

R/boxr_save_load.R#L62

Added line #L62 was not covered by tests

save.image(file = temp_file)

Expand Down
5 changes: 2 additions & 3 deletions R/boxr_write.R
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,8 @@ box_write <- function(object, file_name, dir_id = box_getwd(), description = NUL
}

# using local_tempdir() to preserve the filename
temp_dir <- withr::local_tempdir()
temp_file <- fs::path(temp_dir, file_name)

temp_file <- fs::path(withr::local_tempdir(), file_name)

Check warning on line 72 in R/boxr_write.R

View check run for this annotation

Codecov / codecov/patch

R/boxr_write.R#L72

Added line #L72 was not covered by tests

write_fun(object, temp_file, ...)
box_ul(dir_id = dir_id, file = temp_file, description = description)
}
Expand Down

0 comments on commit 0fa48a2

Please sign in to comment.