summaryrefslogtreecommitdiff
path: root/R/install_PELMO.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/install_PELMO.R')
-rw-r--r--R/install_PELMO.R36
1 files changed, 36 insertions, 0 deletions
diff --git a/R/install_PELMO.R b/R/install_PELMO.R
new file mode 100644
index 0000000..02b1064
--- /dev/null
+++ b/R/install_PELMO.R
@@ -0,0 +1,36 @@
+#' Download FOCUS PELMO from the official site and unzip into the package installation directory
+#'
+#' @importFrom clipr write_clip
+#' @param version The FOCUS PELMO version to install
+#' @export
+install_PELMO <- function(version = "5.5.3", local_zip = NULL) {
+ pkg_dir <- system.file(package = "PELMO.installeR")
+ setup_dir <- file.path(pkg_dir, paste0("PELMO_", gsub("\\.", "", version), "_setup"))
+ if (!dir.exists(setup_dir)) dir.create(setup_dir)
+
+ if (is.null(local_zip)) {
+ PELMO_file <- paste0("FOCUS_PELMO_", gsub("\\.", "_", version), ".zip")
+ PELMO_url <- paste0("http://esdac.jrc.ec.europa.eu/public_path/projects_data/focus/gw/software/",
+ PELMO_file)
+ PELMO_zip <- tempfile(fileext=".zip")
+ download.file(PELMO_url, PELMO_zip)
+ } else {
+ if (file.exists(local_zip)) {
+ PELMO_zip <- local_zip
+ } else {
+ stop(local_zip, " does not exist")
+ }
+ }
+
+ unzip(PELMO_zip, exdir = setup_dir, junkpaths = TRUE)
+ oldwd <- setwd(setup_dir)
+ message("The FOCUS PELMO installer will now start.")
+ message("Please select the following directory in the installation process:")
+ PELMO_dest_dir <- paste0("Z:", gsub("/", "\\\\", pkg_dir),
+ "\\FOCUSPELMO.", gsub("\\.", "", version))
+ message(PELMO_dest_dir)
+ message("This is now being pasted to the system clipboard")
+ write_clip(PELMO_dest_dir)
+ system("wine setup.exe")
+ setwd(oldwd)
+}

Contact - Imprint