[R-pkg-devel] .gitkeep file to prevent folder from erasing when empty

Uwe Ligges ligges at statistik.tu-dortmund.de
Tue Oct 4 13:09:15 CEST 2016



On 04.10.2016 01:58, Luck Buttered wrote:
> Hello everyone:
>
> Inside .Rbuildignore, I put the following line:
>
> ^OutputFolder$


Then indicate that you just want to ignore files within OutputFolder.

Best,
Uwe Ligges






> However, I notice that the extdata/OutputFolder still disappears if
> there are no files inside of it. (I am thinking this happens when I push
> changes to Github). I am trying to keep the extdata/OutputFolder present
> (whether or not it has files inside of it) for both github and when I
> submit the package.
>
> Thanks again for any input you may have!
>
>
>
>
> On Mon, Oct 3, 2016 at 8:15 AM, Luck Buttered <luckbuttered at gmail.com
> <mailto:luckbuttered at gmail.com>> wrote:
>
>     Hello everyone:
>
>     Thank you for the helpful suggestions!
>
>     I moved the directory name to the .Rbuildignore file, as Johannes
>     suggested.
>
>     Uwe, thanks for bringing up that topic! Yes, I read that we cannot
>     automatically write files to user's filespace (outside of
>     tempdir()). So, there is nothing in our package that will
>     automatically write to user's filespace. However, we do allow users
>     to manually enter the suggested path when going over examples in the
>     vignette (which is the extdata/OutputFolder).
>
>     We did not think about if users cannot have write access to that
>     folder. However, that will not render the package useless for them.
>     Instead, they can manually enter an output folder pathway that works
>     for them, and follow the vignette examples that way. The presence of
>     the extdata/OutputFolder is just recommended for simplicity with
>     following examples (and if write available for users).
>
>     Thanks again!
>
>     On Mon, Oct 3, 2016 at 2:25 AM, Uwe Ligges
>     <ligges at statistik.tu-dortmund.de
>     <mailto:ligges at statistik.tu-dortmund.de>> wrote:
>
>
>
>         On 03.10.2016 08:13, Johannes Ranke wrote:
>
>             Hi,
>
>             You can include the .gitkeep file in .Rbuildignore. This
>             will prevent it from
>             being present in the package you test or submit, but git
>             willl still see it
>             and keep the directory.
>
>             Johannes
>
>             Am Montag, 3. Oktober 2016, 00:03:33 schrieb Luck Buttered:
>
>                 Hello everyone:
>
>                 I am working on a vignette for a package that outputs
>                 reports for users. As
>                 part of the vignette, users can manually run eval=FALSE
>                 code that creates
>                 example reports. These example reports that they create
>                 can be saved to an
>                 output folder within extdata (extdata/OutputFolder).
>
>
>
>         Note that this is a bad idea.
>         Your users may not have write access to that folder, e.g. for
>         network wiede installation as the one at my department.
>         Also, you have to ask users (por let them enter a path or file)
>         before writing somewhere on the filespace if not tempdir().
>
>         Best,
>         Uwe Ligges
>
>
>
>
>
>                 When I submit to CRAN, I will be sure that OutputFolder
>                 is empty. However,
>                 whenever I make it empty, the entire folder disappears.
>                 To combat this
>                 problem, I have placed a .gitkeep file within the
>                 OutputFolder.
>
>                 I *believe* the presence of the .gitkeep file works as
>                 intended (prevents
>                 the automatic removal of the OutputFolder when empty).
>                 However, upon
>                 running check(), I receive a note:
>
>                 *checking for hidden files and directories ... NOTE*
>                 *Found the following hidden files and directories:*
>                 *  inst/extdata/OutputFiles/.gitkeep*
>                 *These were most likely included in error. See section
>                 ‘Package*
>                 *structure’ in the ‘Writing R Extensions’ manual.*
>
>                 Does anyone have advice on how to effectively remove
>                 this note? Otherwise,
>                 does my rationale above seem like a reasonable purpose
>                 for keeping the note?
>
>                 Thank you for helping me approach this!
>
>                         [[alternative HTML version deleted]]
>
>                 ______________________________________________
>                 R-package-devel at r-project.org
>                 <mailto:R-package-devel at r-project.org> mailing list
>                 https://stat.ethz.ch/mailman/listinfo/r-package-devel
>                 <https://stat.ethz.ch/mailman/listinfo/r-package-devel>
>
>
>         ______________________________________________
>         R-package-devel at r-project.org
>         <mailto:R-package-devel at r-project.org> mailing list
>         https://stat.ethz.ch/mailman/listinfo/r-package-devel
>         <https://stat.ethz.ch/mailman/listinfo/r-package-devel>
>
>
>



More information about the R-package-devel mailing list