[R-pkg-devel] FW: Writing to users config directory for CRAN package

David Hugh-Jones d@v|dhughjone@ @end|ng |rom gm@||@com
Sun Nov 6 07:41:08 CET 2022


Thank you both. I guess the package can dog food itself by asking one time
whether it can store its files.
D



On Sun, 6 Nov 2022 at 06:33, Jonathan Godfrey <A.J.Godfrey using massey.ac.nz>
wrote:

>
> Further to Dirk's advice, my BrailleR package creates a folder (dumping
> ground). Users are asked if they want to use  one of my choosing, or a
> temporary one. If they choose temporary, they get asked again and again
> until they cave in to my wishes!
>
>
> BrailleR also writes files to the current working directory, but these are
> done because the user has chosen to run a command that has the purpose of
> creating files. I put a warning in the documentation for such functions.
>
> I'm not suggesting my solution is the gold standard, but it is working
> well enough to keep the CRAN checkers happy.
>
> Jonathan
>
>
> -----Original Message-----
> From: R-package-devel <r-package-devel-bounces using r-project.org> On Behalf
> Of Dirk Eddelbuettel
> Sent: Sunday, 6 November 2022 9:29 am
> To: David Hugh-Jones <davidhughjones using gmail.com>
> Cc: R package devel <r-package-devel using r-project.org>
> Subject: Re: [R-pkg-devel] Writing to users config directory for CRAN
> package
>
>
> On 5 November 2022 at 19:32, David Hugh-Jones wrote:
> | I'm considering submitting the package onetime (
> |
> https://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fhughjonesd%2Fonetime%2F&data=05%7C01%7Ca.j.godfrey%40massey.ac.nz%7C33d5f70186284052580908dabf6c7826%7C388728e1bbd0437898dcf8682e644300%7C1%7C0%7C638032769864581576%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=EbBh9XCyyKsRTACo7eLxASZW3pm%2BTrXxzKjjnxBa%2Fpo%3D&reserved=0)
> to CRAN.
> |
> | Onetime has functions for showing a message or warning only once (ever
> | per user). It does this by writing to a file in the user's
> | configuration directory, as reported by rappdirs::user_config_dir().
>
> There is a base R function tools::R_user_dir() which I use in a few
> packages along with packageName() to store config information across
> sessions. A quick search at GitHub's 'cran' org mirroring CRAN finds 110
> hits:
>
>
> https://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fsearch%3Fq%3Dorg%253Acran%2BR_user_dir%26type%3Dcode&data=05%7C01%7Ca.j.godfrey%40massey.ac.nz%7C33d5f70186284052580908dabf6c7826%7C388728e1bbd0437898dcf8682e644300%7C1%7C0%7C638032769864737810%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Wlqbm0tZX0h25rm0veh%2F15IAwJ5mqP9VNPUovlaPhdY%3D&reserved=0
>
> You could keep a hashmap in that directory, and maybe (before it has been
> written a first time) alert the user that you cannot write without
> (initial) permission.  As I recall, the idea behind the (sensible) CRAN
> Policy is to not litter user directories with random files with the user
> knowing.
>
> Dirk
>
> --
> dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org
>
> ______________________________________________
> R-package-devel using r-project.org mailing list
>
> https://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-package-devel&data=05%7C01%7Ca.j.godfrey%40massey.ac.nz%7C33d5f70186284052580908dabf6c7826%7C388728e1bbd0437898dcf8682e644300%7C1%7C0%7C638032769864737810%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=kB8nHrtC5yGEm4tnOTZDOAGT%2FmtDViGblNvieFlZq7g%3D&reserved=0
>
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>
-- 
Sent from Gmail Mobile

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list