Skip to content

Commit 707c9b1

Browse files
authored
getDependency() shouldn't be returning absolute src paths, closes #320 (#384)
1 parent 31aedb6 commit 707c9b1

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

R/utils.R

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ getDependency <- function(name, package = name){
4949
# in this cases dependencies should be provided through the
5050
# dependencies argument of createWidget
5151
widgetDep <- list()
52-
if(file.exists(system.file(config, package = package))) {
52+
if (file.exists(system.file(config, package = package))) {
5353
config = yaml::yaml.load_file(
5454
system.file(config, package = package)
5555
)
56-
widgetDep <- lapply(config$dependencies, function(l){
57-
l$src = system.file(l$src, package = package)
56+
widgetDep <- lapply(config$dependencies, function(l) {
57+
l$package = package
5858
do.call(htmlDependency, l)
5959
})
6060
}
@@ -63,17 +63,23 @@ getDependency <- function(name, package = name){
6363
# some other mechanism such as a specified `htmlDependency` or `script` tag.
6464
# Note, this is a very special case.
6565
bindingDep <- if (file.exists(system.file(jsfile, package = package))) {
66-
bindingDir <- system.file("htmlwidgets", package = package)
6766
htmlDependency(
68-
paste0(name, "-binding"), packageVersion(package),
69-
bindingDir, script = basename(jsfile), all_files = FALSE
67+
name = paste0(name, "-binding"),
68+
version = packageVersion(package),
69+
src = "htmlwidgets",
70+
package = package,
71+
script = basename(jsfile),
72+
all_files = FALSE
7073
)
7174
}
7275

7376
c(
74-
list(htmlDependency("htmlwidgets", packageVersion("htmlwidgets"),
75-
src = system.file("www", package="htmlwidgets"),
76-
script = "htmlwidgets.js"
77+
list(htmlDependency(
78+
name = "htmlwidgets",
79+
version = packageVersion("htmlwidgets"),
80+
src = "www",
81+
package = "htmlwidgets",
82+
script = "htmlwidgets.js"
7783
)),
7884
widgetDep,
7985
list(bindingDep)

0 commit comments

Comments
 (0)