rspatial / geodata

download geographic data
GNU General Public License v3.0
150 stars 15 forks source link

create 'path' if it doesn't exist #10

Closed AMBarbosa closed 2 years ago

AMBarbosa commented 2 years ago

Not a big deal, but the functions with a 'path' argument throw an error if "dir.exists(path) is not TRUE". Unless there's a reason otherwise, it would be useful to add them something like if(!dir.exists(path)) dir.create(path, recursive = TRUE)

rhijmans commented 2 years ago

The reason I did not do that is that this may happen (at least to me) because of a typo. I have now changed it to the middle ground: dir.create(path, recursive = FALSE)

AMBarbosa commented 2 years ago

Cool, thanks! This seems to be implemented in most functions, but still missing in world, gadm, and elevation_3s.

rhijmans commented 2 years ago

Ay, good catch. My automatic replace did not catch all cases --- as should have been expected. Fixed now.