prioritizr / wdpar

Interface to the World Database on Protected Areas
https://prioritizr.github.io/wdpar
GNU General Public License v3.0
37 stars 5 forks source link

Fix "global" argument for Mac #81

Closed jaseeverett closed 3 months ago

jaseeverett commented 3 months ago

This seems to work on 2 x MBPs (M1Max and M2Pro)

Including the getOption seemed to solve the unzip issue. rappdirs returned a ~ for the home directory which then didn't work with the unzip, so I added a expand.path

closes #79

jeffreyhanson commented 3 months ago

Thank you very much for the PR @jaseeverett! Just a quick question, why the need to set utils::unzip(x, exdir = tdir, unzip = getOption("unzip"))? Does the default "internal" for unzip() not work on macs? Sorry just saw your edit to the post.

jaseeverett commented 3 months ago

Thank you very much for the PR @jaseeverett! Just a quick question, why the need to set utils::unzip(x, exdir = tdir, unzip = getOption("unzip"))? Does the default "internal" for unzip() not work on macs? Sorry just saw your edit to the post.

No worries. No it doesn't. That was the core issue. The file downloaded fine, but the error was the unzipping. There are numerous posts around the web about the M1/M2/M3 Macs not unzipping without the getOption. I don't know the underlying issue and why it is different to internal......

jeffreyhanson commented 3 months ago

Ah - interesting! Thanks for tracking that down

jeffreyhanson commented 3 months ago

@jaseeverett, I've just added a commit to your PR to help make it robust against a potentially argument to download_dir (e.g., in case a user accidently supplied a number, NULL, NA value, etc). Could you please check that I haven't accidently broken your patch on your mac computer?

jaseeverett commented 3 months ago

No it fails. I think it's because you test the assertion before creating the directory. I have added a comment.

jeffreyhanson commented 3 months ago

Just pushed a commit it to fix that, could you try again?

jaseeverett commented 3 months ago

Works well now

jeffreyhanson commented 3 months ago

Awesome - thanks!