Commit 347f9e2 1 parent a40a1b8 commit 347f9e2 Copy full SHA for 347f9e2
File tree 3 files changed +24
-6
lines changed
3 files changed +24
-6
lines changed Original file line number Diff line number Diff line change 6
6
# ' database on Windows. It is used in tests and vignettes.
7
7
# ' @noRd
8
8
# ' @keywords internal
9
- download_tzdata_on_windows <- function () {
9
+ download_tzdata_on_windows <- function (tzdir = NULL ) {
10
10
if (.Platform $ OS.type != " windows" ) {
11
11
cli :: cli_alert_info(
12
12
" Timezone database is already provided by {(.Platform)$OS.type}"
@@ -15,9 +15,13 @@ download_tzdata_on_windows <- function() {
15
15
}
16
16
17
17
# Define paths
18
- tzdata_path <- path.expand(
19
- file.path(Sys.getenv(" USERPROFILE" ), " Downloads" , " tzdata" )
20
- )
18
+ if (is.null(tzdir )) {
19
+ tzdata_path <- path.expand(
20
+ file.path(Sys.getenv(" USERPROFILE" ), " Downloads" , " tzdata" )
21
+ )
22
+ } else {
23
+ tzdata_path <- tzdir
24
+ }
21
25
tzdata_compressed <- file.path(tzdata_path , " tzdata.tar.gz" )
22
26
23
27
# Create directory if it doesn't exist
@@ -48,3 +52,17 @@ download_tzdata_on_windows <- function() {
48
52
utils :: download.file(windows_zones_url , windows_zones_path , mode = " wb" )
49
53
return (tzdata_path )
50
54
}
55
+
56
+ # ' wrapper for download_tzdata_on_windows for GitHub Actions
57
+ # ' @noRd
58
+ # ' @keywords internal
59
+ download_tzdata_on_windows_gha <- function () {
60
+ if (Sys.getenv(" RUNNER_OS" ) == " Windows" ) {
61
+ return (download_tzdata_on_windows(" C:/Users/runneradmin/Downloads/tzdata" ))
62
+ } else {
63
+ cli :: cli_alert_info(
64
+ " Not running on Windows GitHub Action"
65
+ )
66
+ return (NULL )
67
+ }
68
+ }
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ pcreek <- system.file(
6
6
sf :: read_sf()
7
7
8
8
# --- Setup the testing environment.
9
- windows_tz_dir <- chewie ::: download_tzdata_on_windows ()
9
+ windows_tz_dir <- chewie ::: download_tzdata_on_windows_gha ()
10
10
aum <- options(arrow.unsafe_metadata = TRUE )
11
11
temp_dir <- tempdir()
12
12
old_chewie_cache <- chewie :: chewie_get_cache()
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ knitr::opts_chunk$set(
12
12
collapse = TRUE,
13
13
comment = "#>"
14
14
)
15
- windows_tz_dir <- chewie:::download_tzdata_on_windows ()
15
+ windows_tz_dir <- chewie:::download_tzdata_on_windows_gha ()
16
16
options(arrow.unsafe_metadata = TRUE)
17
17
options("chewie.testing" = TRUE)
18
18
temp_dir <- tempdir()
You can’t perform that action at this time.
0 commit comments