Skip to content

Commit

Permalink
use withr::local_tempdir()
Browse files Browse the repository at this point in the history
  • Loading branch information
ijlyttle committed Jan 6, 2024
1 parent 2eb0612 commit 8c83637
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions R/boxr_save_load.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@ box_save_image <- function(dir_id = box_getwd(), file_name = ".RData",
}
}

# TODO: fs
temp_file <- normalizePath(file.path(tempdir(), file_name), mustWork = FALSE)
on.exit(fs::file_delete(temp_file))

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

Check warning on line 63 in R/boxr_save_load.R

View check run for this annotation

Codecov / codecov/patch

R/boxr_save_load.R#L62-L63

Added lines #L62 - L63 were not covered by tests

save.image(file = temp_file)

box_ul(dir_id, temp_file, description = description)
Expand Down

0 comments on commit 8c83637

Please sign in to comment.