Skip to content

Commit

Permalink
Fixes 192: Use file.copy for cross-disk flexibility in HYDAT download (
Browse files Browse the repository at this point in the history
…#205)

* Fixes 192: Use file.copy for cross-disk flexibility in HYDAT download

Replaced file.rename with file.copy to handle situations where the temp folder and the destination are on different physical disks (e.g. Docker container with different mount points for the tempdir and the destination).

* destination file should be be overwritten

* Update NEWS.md

* Update NEWS.md

added some backticks
  • Loading branch information
mpdavison authored Oct 1, 2024
1 parent af345e4 commit b288272
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
- fix bug where `download_hydat()` fails if `tempdir()` is on a different device than `hydat_path` (@mpdavison, #192)

# tidyhydat 0.6.1
- Add `...` to print methods so you can pass arguments all the way down.
- Add workaround for vroom#519 bug that prevents `realtime_*` functions from working
Expand Down
5 changes: 3 additions & 2 deletions R/download.R
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,10 @@ download_hydat <- function(dl_hydat_here = NULL, ask = TRUE) {
on.exit(unlink(tempdir, recursive = TRUE))

## Move to final resting place and rename to consistent name
file.rename(
file.copy(
list.files(tempdir, pattern = "\\.sqlite3$", full.names = TRUE),
hydat_path
hydat_path,
overwrite = TRUE
)


Expand Down

0 comments on commit b288272

Please sign in to comment.