@@ -339,22 +339,35 @@ install_yihui_pkgs = function() {
339339# install a prebuilt version of TinyTeX
340340install_prebuilt = function () {
341341 if (is_windows()) {
342- installer = ' TinyTeX.zip'
343- download_file(' https://ci.appveyor.com/api/projects/yihui/tinytex/artifacts/TinyTeX.zip' , installer )
344- install_windows_zip(installer )
342+ install_windows_zip()
345343 } else if (is_linux()) {
346344 system(' wget -qO- https://yihui.org/gh/tinytex/tools/download-travis-linux.sh | sh' )
345+ } else if (is_macos()) {
346+ install_macos_tgz()
347347 } else {
348348 stop(' TinyTeX was not prebuilt for this platform.' )
349349 }
350350}
351351
352+ download_installer = function (file , extra = ' ' ) {
353+ download_file(paste0(
354+ ' https://ci.appveyor.com/api/projects/yihui/tinytex/artifacts/' , file , URLencode(extra )
355+ ), file )
356+ }
357+
352358# if you have already downloaded the zip archive, use this function to install it
353359install_windows_zip = function (path = ' TinyTeX.zip' ) {
360+ if (missing(path ) && ! file.exists(path )) download_installer(path , ' ?job=image: Visual Studio 2019' )
354361 unzip(path , exdir = win_app_dir())
355362 tlmgr_path(); texhash(); fmtutil(); updmap(); fc_cache()
356363}
357364
365+ install_macos_tgz = function (path = ' TinyTeX.tar.gz' ) {
366+ if (missing(path ) && ! file.exists(path )) download_installer(path , ' ?job=image: macos' )
367+ untar(path , exdir = path.expand(' ~/Library' ))
368+ tlmgr_path()
369+ }
370+
358371# ' Copy TinyTeX to another location and use it in another system
359372# '
360373# ' The function \code{copy_tinytex()} copies the existing TinyTeX installation
0 commit comments