jsta / nhdR

R interface to the National Hydrography Dataset :droplet:
https://jsta.github.io/nhdR/
37 stars 11 forks source link

nhd_path() fails to create directories #56

Closed jpshanno closed 5 years ago

jpshanno commented 5 years ago

I installed nhdR this morning and found that nhd_get() was failing to unzip the download with the following error:

Downloading https://prd-tnm.s3.amazonaws.com/StagedProducts/Hydrography/NHD/State/HighResolution/GDB/NHD_H_Minnesota_State_GDB.zip Error in curl::curl_fetch_disk(url, x$path, handle = handle) : Failed to open file C:\Users\jpshanno\AppData\Local\nhdR\nhdR\NHD_H_Minnesota_State_GDB.zip.

After tracing the problem back I found that nhd_path() was failing to create the app directory, so the download was failing as the destination directory didn't exist. Setting recursive = TRUE in dir.create() inside of nhd_path() should fix the problem.

jsta commented 5 years ago

Thanks for the bug report. Can you verify that the latest commit fixes the issue?

jpshanno commented 5 years ago

Yes that fixed it