Installing RTools on Windows sets some environment variable
RTOOLS40_HOME C:\rtools40
RTOOLS42_HOME C:\rtools42
RTOOLS43_HOME C:\rtools43
Currently RTOOLS43_HOME is not taken into account and the 4.2 one gets selected
|
has_rtools <- function(debug = FALSE) { |
|
if (!debug && rtools_path_is_set()) { |
|
return(!identical(rtools_path(), "")) |
|
} |
|
|
|
if (!is_windows()) { |
|
return(FALSE) |
|
} |
|
|
|
# R 4.2.x or later and ucrt? |
|
ucrt <- is_ucrt() |
|
if (ucrt) { |
|
rtools42_home <- Sys.getenv("RTOOLS42_HOME", "C:\\rtools42") |
|
if (file.exists(file.path(rtools42_home, "usr", "bin"))) { |
|
if (debug) { |
|
cat("Found in Rtools 4.2 installation folder\n") |
|
} |
|
rtools_path_set(rtools(rtools42_home, "4.2")) |
|
return(TRUE) |
|
} |
|
} |
|
|
|
# In R 4.0 we can use RTOOLS40_HOME, recent versions of Rtools40 work fine |
|
# with ucrt as well, currently. |
|
if (is_R4()) { |
|
rtools40_home <- Sys.getenv("RTOOLS40_HOME", "C:\\rtools40") |
|
fld <- if (ucrt) "ucrt64" else "usr" |
|
if (file.exists(file.path(rtools40_home, fld, "bin"))) { |
|
if (debug) { |
|
cat("Found in Rtools 4.0 installation folder\n") |
|
} |
|
rtools_path_set(rtools(rtools40_home, "4.0")) |
|
return(TRUE) |
|
} |
|
} |