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

Uwe Ligges ligges at statistik.tu-dortmund.de
Mon Oct 3 09:25:16 CEST 2016



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 mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-package-devel



More information about the R-package-devel mailing list