forked from dankelley/oce
-
Notifications
You must be signed in to change notification settings - Fork 0
/
check_urls.R
28 lines (28 loc) · 934 Bytes
/
check_urls.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
if (requireNamespace("RCurl", quietly=TRUE)) {
debug <- FALSE
files <- list.files(pattern="*.R$")
files <- files[-which(files == "check_urls.R")]
for (file in files) {
l <- readLines(file)
u <- grep("\\\\url", l)
if (length(u)) {
message(file)
l <- l[u]
for (li in l) {
li2 <- gsub("^.*\\\\url\\{([^\\{]*)\\}.*$", "\\1", li)
if (nchar(li2) < 1)
message(" odd line: '", li, "' yielding zero-length url component")
if (debug) {
message(" > '", li, "'")
message(" > '", li2, "'")
}
ok <- RCurl::url.exists(li2)
if (!ok) {
message(" > '", li, "'")
message(" > '", li2, "'")
message(" ERROR")
}
}
}
}
}