Skip to content

Commit

Permalink
webR: Continue initialisation if mounting fails (#167)
Browse files Browse the repository at this point in the history
  • Loading branch information
georgestagg authored Jul 31, 2024
1 parent bcb472b commit 633f0c0
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/hooks/useWebR.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -282,17 +282,19 @@ webr::shim_install()
available <- data$cached
mountpoint <- glue::glue("/shinylive/webr/packages/{name}")
# Mount the virtual filesystem image, unless we already have done so
if (available && !file.exists(mountpoint)) {
webr::mount(mountpoint, glue::glue("{.base_url}{path}"))
}
# If this is a full library, add it to .libPaths()
if(data$type == "library") {
paths <- .libPaths()
paths <- append(paths, mountpoint , after = length(paths) - 1)
.libPaths(paths)
}
try({
# Mount the virtual filesystem image, unless we already have done so
if (available && !file.exists(mountpoint)) {
webr::mount(mountpoint, glue::glue("{.base_url}{path}"))
}
# If this is a full library, add it to .libPaths()
if(data$type == "library") {
paths <- .libPaths()
paths <- append(paths, mountpoint , after = length(paths) - 1)
.libPaths(paths)
}
})
})
}
Expand Down

0 comments on commit 633f0c0

Please sign in to comment.