Skip to content

Commit b5be10a

Browse files
committed
insane hack to replace April with Apr in northamerica file
1 parent 347f9e2 commit b5be10a

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

R/internal-helpers.R

+12-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ download_tzdata_on_windows <- function(tzdir = NULL) {
3737

3838
# Check if the file exists
3939
if (!file.exists(tzdata_compressed)) {
40-
stop("Failed to download the timezone database.")
40+
cli::cli_abort("Failed to download the timezone database.")
4141
}
4242

4343
# Extract the tar.gz file
@@ -50,6 +50,17 @@ download_tzdata_on_windows <- function(tzdir = NULL) {
5050
)
5151
windows_zones_path <- file.path(tzdata_path, "windowsZones.xml")
5252
utils::download.file(windows_zones_url, windows_zones_path, mode = "wb")
53+
54+
# Find the "northamerica" file and replace "April" with "Apr"
55+
northamerica_file <- file.path(tzdata_path, "northamerica")
56+
if (file.exists(northamerica_file)) {
57+
file_contents <- readLines(northamerica_file)
58+
file_contents <- gsub("April", "Apr", file_contents)
59+
writeLines(file_contents, northamerica_file)
60+
} else {
61+
cli::cli_warn("northamerica file not found in tzdata_path")
62+
}
63+
5364
return(tzdata_path)
5465
}
5566

0 commit comments

Comments
 (0)