httr2 icon indicating copy to clipboard operation
httr2 copied to clipboard

Replace rappdirs by tools::R_user_dir()

Open Bisaloo opened this issue 3 months ago • 3 comments

I see that this change was made in other r-lib repos so I thought I'd suggest it here as well.

tools::R_user_dir() was introduced in R 4.0 so safe to use with the tidyverse R version support policy/

Bisaloo avatar Aug 28 '25 20:08 Bisaloo

I think this probably needs a bit more thought than in other packages, because we'd need to make sure that this directory eventually gets cleaned up.

hadley avatar Aug 28 '25 21:08 hadley

But I don't see any mechanism in rappdirs to clean up. My understanding is that the user or the OS takes care of this. In which case, the situation should be the same with the folder created by tools::R_user_dir().

As far as I understand, the main difference between rappdirs and tools::R_user_dir() is that rappdirs covers the different cases (config, cache, etc.) via different functions while tools::R_user_dir() does it via its which argument.

Am I missing something?

Bisaloo avatar Aug 29 '25 19:08 Bisaloo

httr2 has cache_disk_prune() which is called automatically on load, and ensures that all tokens > 30 days old are deleted. These tokens can be used to do stuff on your behalf so I wanted to avoid having them lay around for an unlimited amount of time.

hadley avatar Aug 29 '25 19:08 hadley