Skip to content

Commit be3cab0

Browse files
committed
try fix win oldrel4
1 parent 71f5479 commit be3cab0

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

R/internal_utilities.R

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,28 @@ platform_detect <- function(quiet = TRUE) {
1515
stop(cli::cli_abort("Unsupported platform"))
1616
)
1717

18-
arch <- switch(
19-
sys_info["machine"],
20-
"x86-64" = "x64",
21-
"x86_64" = "x64",
22-
"i386" = "x86",
23-
"i486" = "x86",
24-
"i586" = "x86",
25-
"i686" = "x86",
26-
"aarch64" = "aarch64",
27-
"arm64" = "aarch64",
28-
stop(cli::cli_abort("Unsupported architecture"))
29-
)
18+
# NEW: Check R_ARCH first, then fall back to Sys.info()
19+
r_arch_env <- Sys.getenv("R_ARCH")
20+
21+
if (r_arch_env == "/i386") {
22+
arch <- "x86"
23+
} else if (r_arch_env == "/x64") {
24+
arch <- "x64"
25+
} else {
26+
# Fallback for non-Windows or when not in a build context
27+
arch <- switch(
28+
sys_info["machine"],
29+
"x86-64" = "x64",
30+
"x86_64" = "x64",
31+
"i386" = "x86",
32+
"i486" = "x86",
33+
"i586" = "x86",
34+
"i686" = "x86",
35+
"aarch64" = "aarch64",
36+
"arm64" = "aarch64",
37+
stop(cli::cli_abort("Unsupported architecture"))
38+
)
39+
}
3040

3141
if (isFALSE(quiet)) {
3242
cli::cli_inform("Detected platform: {os}")
@@ -36,7 +46,6 @@ platform_detect <- function(quiet = TRUE) {
3646
return(list(os = os, arch = arch))
3747
}
3848

39-
4049
#' Load Java URLs from JSON file
4150
#'
4251
#' @keywords internal

0 commit comments

Comments
 (0)