Skip to content

Commit

Permalink
tweak: Include required OM files in package
Browse files Browse the repository at this point in the history
- Internet connection could be unstable or not available, thus we simply
  include these files from the beginning
  • Loading branch information
rogoersTPH committed Mar 4, 2024
1 parent ecc0dcd commit b0a83cc
Show file tree
Hide file tree
Showing 4 changed files with 10,312 additions and 12 deletions.
38 changes: 26 additions & 12 deletions R/base.R
Original file line number Diff line number Diff line change
Expand Up @@ -226,14 +226,21 @@ setupOM <- function(version = 44, dir = NULL) {
for (f in c("autoRegressionParameters.csv", "densities.csv")) {
.printDebug(paste0("Trying to download ", f))
if (!file.exists(file.path(dir, f))) {
utils::download.file(
url = paste0(
"https://raw.githubusercontent.com/SwissTPH/openmalaria/schema-",
version,
"/test/", f
# Copy shipped file
file.copy(
from = file.path(
system.file(package = "openMalariaUtilities"), "extdata", f
),
destfile = file.path(dir, f)
to = file.path(dir, f), overwrite = TRUE
)
## utils::download.file(
## url = paste0(
## "https://raw.githubusercontent.com/SwissTPH/openmalaria/schema-",
## version,
## "/test/", f
## ),
## destfile = file.path(dir, f)
## )
} else {
message(paste0("File ", f, " already exists, skipping."))
}
Expand All @@ -243,14 +250,21 @@ setupOM <- function(version = 44, dir = NULL) {
f <- paste0("scenario_", major, ".xsd")
.printDebug(paste0("Trying to download ", f))
if (!file.exists(file.path(dir, f))) {
utils::download.file(
url = paste0(
"https://raw.githubusercontent.com/SwissTPH/openmalaria/schema-",
version,
"/schema/", f
# Copy shipped file
file.copy(
from = file.path(
system.file(package = "openMalariaUtilities"), "extdata", f
),
destfile = file.path(dir, f)
to = file.path(dir, f), overwrite = TRUE
)
## utils::download.file(
## url = paste0(
## "https://raw.githubusercontent.com/SwissTPH/openmalaria/schema-",
## version,
## "/schema/", f
## ),
## destfile = file.path(dir, f)
## )
} else {
message(paste0("File ", f, " already exists, skipping."))
}
Expand Down
Loading

0 comments on commit b0a83cc

Please sign in to comment.