| 1 |
|
| 2 |
renv_methods_map <- function() { |
| 3 |
|
| 4 |
list( |
| 5 |
|
| 6 |
renv_path_normalize = c( |
| 7 |
unix = "renv_path_normalize_unix", |
| 8 |
win32 = "renv_path_normalize_win32" |
| 9 |
), |
| 10 |
|
| 11 |
renv_file_exists = c( |
| 12 |
unix = "renv_file_exists_unix", |
| 13 |
win32 = "renv_file_exists_win32" |
| 14 |
), |
| 15 |
|
| 16 |
renv_file_list_impl = c( |
| 17 |
unix = "renv_file_list_impl_unix", |
| 18 |
win32 = "renv_file_list_impl_win32" |
| 19 |
), |
| 20 |
|
| 21 |
renv_file_broken = c( |
| 22 |
unix = "renv_file_broken_unix", |
| 23 |
win32 = "renv_file_broken_win32" |
| 24 |
) |
| 25 |
|
| 26 |
) |
| 27 |
|
| 28 |
} |
| 29 |
|
| 30 |
renv_methods_init <- function() { |
| 31 |
|
| 32 |
# get list of method mappings |
| 33 |
methods <- renv_methods_map() |
| 34 |
|
| 35 |
# determine appropriate lookup key for finding alternative |
| 36 |
key <- if (renv_platform_windows()) "win32" else "unix" |
| 37 |
alts <- map(methods, `[[`, key) |
| 38 |
|
| 39 |
# update methods in namespace |
| 40 |
envir <- renv_envir_self() |
| 41 |
enumerate(alts, function(name, alt) { |
| 42 |
replacement <- eval(parse(text = alt), envir = envir) |
| 43 |
assign(name, replacement, envir = envir) |
| 44 |
}) |
| 45 |
|
| 46 |
} |