11if (! file.exists(" ../windows/tesseract/include/tesseract/baseapi.h" )) {
2- unlink(" ../windows" , recursive = TRUE )
2+ unlink(" ../windows/tesseract " , recursive = TRUE )
33 url <- if (grepl(" aarch" , R.version $ platform )) {
44 " https://github.com/pachadotdev/cpp11bundles/releases/download/tesseract-5.3.2/tesseract-ocr-5.3.2-clang-aarch64.tar.xz"
55 } else if (grepl(" clang" , Sys.getenv(" R_COMPILED_BY" ))) {
@@ -8,17 +8,16 @@ if (!file.exists("../windows/tesseract/include/tesseract/baseapi.h")) {
88 " https://github.com/pachadotdev/cpp11bundles/releases/download/tesseract-5.3.2/tesseract-ocr-5.3.2-ucrt-x86_64.tar.xz"
99 }
1010 download.file(url , basename(url ), quiet = TRUE )
11- dir.create(" ../windows" , showWarnings = FALSE )
1211 untar(basename(url ), exdir = " ../windows" , tar = " internal" )
12+ file.rename(file.path(" ../windows" , dir(" ../windows" , pattern = " tesseract-" )), " ../windows/tesseract" )
1313 unlink(basename(url ))
1414 setwd(" ../windows" )
15- file.rename(list.files(), " tesseract" )
1615}
1716
1817# Also download the english training data
19- dir.create(" ../windows/tessdata" , showWarnings = FALSE )
2018if (! file.exists(" ../windows/tessdata/eng.traineddata" )) {
2119 message(" Downloading eng.traineddata..." )
20+ dir.create(" ../windows/tessdata" , showWarnings = FALSE )
2221 download.file(" https://github.com/tesseract-ocr/tessdata_fast/raw/4.1.0/eng.traineddata" ,
2322 " ../windows/tessdata/eng.traineddata" ,
2423 mode = " wb" , quiet = TRUE
0 commit comments