Skip to content

Commit

Permalink
use xfun::file_rename()
Browse files Browse the repository at this point in the history
  • Loading branch information
yihui committed Oct 9, 2024
1 parent a161954 commit 239eb91
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: tinytex
Type: Package
Title: Helper Functions to Install and Maintain TeX Live, and Compile LaTeX Documents
Version: 0.53.1
Version: 0.53.2
Authors@R: c(
person("Yihui", "Xie", role = c("aut", "cre", "cph"), email = "[email protected]", comment = c(ORCID = "0000-0003-0645-5666")),
person(given = "Posit Software, PBC", role = c("cph", "fnd")),
Expand All @@ -16,7 +16,7 @@ Description: Helper functions to install and maintain the 'LaTeX' distribution
portable, and easy-to-maintain version of 'TeX Live'. This package also
contains helper functions to compile 'LaTeX' documents, and install missing
'LaTeX' packages automatically.
Imports: xfun (>= 0.29)
Imports: xfun (>= 0.48)
Suggests: testit, rstudioapi
License: MIT + file LICENSE
URL: https://github.com/rstudio/tinytex
Expand Down
10 changes: 1 addition & 9 deletions R/latex.R
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ latexmk = function(
if (is_latex) pdf_file = with_ext(pdf_file, 'dvi')
check_pdf = function() {
if (!file.exists(pdf)) show_latex_error(file, with_ext(pdf, 'log'), TRUE)
file_rename(pdf, pdf_file)
xfun::file_rename(pdf, pdf_file)
pdf_file
}
if (engine == 'tectonic') {
Expand Down Expand Up @@ -474,14 +474,6 @@ exist_files = function(files) {
files[utils::file_test('-f', files)]
}

# use file.copy() if file.rename() fails
file_rename = function(from, to) {
if (from == to) return(TRUE)
if (!suppressWarnings(file.rename(from, to))) {
if (file.copy(from, to, overwrite = TRUE)) file.remove(from)
}
}

#' Find missing LaTeX packages from a LaTeX log file
#'
#' Analyze the error messages in a LaTeX log file to figure out the names of
Expand Down

0 comments on commit 239eb91

Please sign in to comment.