[R-pkg-devel] Problem persists, was Re: Problem compressing vignettes for CRAN

Jeff Newmiller jdnewm|| @end|ng |rom dcn@d@v|@@c@@u@
Mon Oct 9 17:32:48 CEST 2023


R could care less about what is in PATH... there is however a difference between Windows parsing PATH and how CMD lets you quote things interactively.

The whole point of PATH is to let you or R provide simple program names like qpdf without knowing where they are... Windows takes over and looks up where the program actually is based on the contents of PATH. How you get things into that environment variable can vary depending on which software you are using (CMD and R are two possible options), but the actual content is handled by the operating system (which is why PATH on Linux is formatted differently than PATH on Windows).

On October 9, 2023 8:22:17 AM PDT, Michael Dewey <lists using dewey.myzen.co.uk> wrote:
>Dear Ivan (and list)
>
>Using Ivan's advice I traced the problem to a difference of opinio between Microsoft and R about paht names. I had mistakenly enclosed parts of the names in "" which was fine for MS but not R. Sys.which() was my saviour here.
>
>Many thanks to Ivan for broadening my knowledge of useful functions like Sys.which().
>
>Michael
>
>On 09/10/2023 08:51, Ivan Krylov wrote:
>> On Sun, 8 Oct 2023 16:47:41 +0100
>> Michael Dewey <lists using dewey.myzen.co.uk> wrote:
>> 
>>> Following on from Ivan's advice I have now installed qpdf and
>>> Ghostview. I have checked that they are both on my path by typing
>>> their name at the command line and verifying they open.
>> 
>>> I then built the package with the --compress-vignettes=both and then
>>> checked it with --as-cran I still get a complaint that it needs qpdf
>>> to check compression.
>> 
>> While running R, does Sys.which('qpdf') return the path to qpdf.exe?
>> Does Sys.getenv('PATH') match your expectations?
>> 
>>> I notice that in the Writing R Extensions manual in section 1.6.1 it
>>> states "The full path to the qpdf command can be supplied as
>>> environment variable R_QPDF ..."
>>> 
>>> Is that a typo for "must be supplied"?
>> 
>> Well, R tries to resolve the path to qpdf.exe using Sys.which(), so it
>> must work if it's on the %PATH%, but if all else fails, setting this
>> environment variable should help.
>> 
>>> If it is where can I find the answers to questions about how R
>>> accepts Windows paths? Do I need to enclose parts of names containing
>>> spaces in "" signs?
>> 
>> It always depends on how the final command line is built by a
>> particular function, but it should work by taking plain file paths
>> without any escaping and quotation. The directory separators shouldn't
>> matter either.
>> 
>> (tools::compactPDF uses system2(), so it quotes the path to the
>> executable by itself.)
>> 
>>> Does it mean the path up to, in this case, bin or must I include
>>> qpdf.exe after it?
>> 
>> It must be the full path to the executable, including the final
>> qpdf.exe.
>> 
>>> I assume I do not need to do anything special to get it to find
>>> Ghostscript?
>> 
>> tools::compactPDF() expects gswin64c.exe or gswin32c.exe on the PATH.
>> If it's not there, R_GSCMD must be set to the full path to the
>> executable. Judging by the NOTE you've received, it's Ghostscript that
>> performed most of the compaction in your case.
>> 
>

-- 
Sent from my phone. Please excuse my brevity.




More information about the R-package-devel mailing list