Quickfix download and cran checks
Great amount of work by @nevrome, many thanks for that! All remaining errors and bugs are my responsibility alone.
80 | 80 | Sys.chmod(exe, mode = "0777") |
|
81 | 81 | ||
82 | 82 | # set path |
|
83 | - | setOxcalExecutablePath(exe) |
|
83 | + | test <- tryCatch(setOxcalExecutablePath(exe), |
|
84 | + | error=function(e) { |
|
85 | + | message("The Oxcal executable path could not be set:") |
|
86 | + | message(e) |
|
87 | + | message("\nIf you received an internet connection error before, please resolve it and try again later") |
|
88 | + | } |
|
89 | + | ) |
|
90 | + | if (!is.null(test) && test==0) { |
|
91 | + | message("Oxcal Setup successful!") |
|
92 | + | } |
|
93 | + | ||
84 | 94 | ||
85 | 95 | return() |
|
86 | 96 | } |
89 | 99 | ## ---------- private ---------- |
|
90 | 100 | downloadOxcal <- function(path = ".") { |
|
91 | 101 | temp <- tempfile() |
|
92 | - | utils::download.file("https://c14.arch.ox.ac.uk/OxCalDistribution.zip", temp) |
|
93 | - | utils::unzip(temp, exdir = path) |
|
94 | - | unlink(temp) |
|
95 | - | message("Oxcal download to ", normalizePath(path), " successful!") |
|
102 | + | ||
103 | + | test <- tryCatch(utils::download.file("https://c14.arch.ox.ac.uk/OxCalDistribution.zip", temp), |
|
104 | + | warning=function(e) { |
|
105 | + | message("Error Downloading OxCalDistribution.zip:") |
|
106 | + | message(e) |
|
107 | + | message("\nNo internet connection or data source broken?") |
|
108 | + | } |
|
109 | + | ) |
|
110 | + | if (!is.null(test) && test==0) { |
|
111 | + | utils::unzip(temp, exdir = path) |
|
112 | + | unlink(temp) |
|
113 | + | message("Oxcal stored successful at ", normalizePath(path), "!") |
|
114 | + | } |
|
96 | 115 | } |
|
97 | 116 | ||
98 | 117 | getOxcalExecutablePath <- function() { |
Files | Coverage |
---|---|
R | 66.23% |
Project Totals (13 files) | 66.23% |