|
1 | 1 | ## -*- mode: R -*- |
2 | 2 | ## loading code which is first sent to R on remote sessions |
3 | 3 | local({ |
4 | | - curver <- '%s' |
5 | | - ## MM: ok for Windows? |
6 | | - ## VS: Should be fine (who is using win remote anyways?) |
7 | | - .c.dir <- '~/.config/ESSR' |
8 | | - verfile <- file.path(.c.dir, 'VERSION') |
9 | | - envfile <- file.path(.c.dir, 'ESSR.rda') |
10 | | - ver <- if(file.exists(verfile)) scan(verfile, what = "string") else "0.0" |
| 4 | + ver <- '%s' |
| 5 | + root <- '~/.config/ESSR' |
| 6 | + if(!file.exists(root)) |
| 7 | + dir.create(root, recursive = TRUE) |
| 8 | + ## cannot use sprintf here |
| 9 | + essr_file <- file.path(root, paste('ESSRv', ver, '.rda', sep = '')) |
11 | 10 | tryCatch({ |
12 | | - if(ver < curver) { |
13 | | - url <- paste('https://vitalie.spinu.info/ESSR/ESSR_', curver, '.rda', sep = '') |
14 | | - if(!file.exists(.c.dir)) |
15 | | - dir.create(.c.dir, recursive = TRUE) |
16 | | - utils::download.file(url, envfile) |
17 | | - cat(curver, file = verfile) |
| 11 | + if(!file.exists(essr_file)) { |
| 12 | + url <- paste('https://github.com/emacs-ess/ESS/raw/ESSRv', ver, '/etc/ESSR.rda', sep = '') |
| 13 | + utils::download.file(url, essr_file) |
18 | 14 | } |
19 | | - load(envfile) |
| 15 | + load(essr_file) |
20 | 16 | attach(ESSR) |
21 | 17 | print(TRUE) |
22 | 18 | } , error = function(e) print(FALSE)) |
|
0 commit comments