but then i found that the inst/htmlwidgets structure doesnt conform to what is in the saveWidget script, more specifically the function htmltools:::copyDependencyToDir()
How could i change things to make saveWidget run?
Thanks
see 4 lines after browser()
copyDependencyToDir<-function (dependency, outputDir, mustWork = TRUE)
{
dir <- dependency$src$file
if (is.null(dir)) {
if (mustWork) {
stop("Dependency ", dependency$name, " ", dependency$version,
" is not disk-based")
}
else {
return(dependency)
}
}
if (length(outputDir) != 1 || outputDir %in% c("", "/"))
stop("outputDir must be of length 1 and cannot be \"\" or \"/\"")
if (!htmltools:::dir_exists(outputDir))
dir.create(outputDir)
target_dir <- if (getOption("htmltools.dir.version", TRUE)) {
paste(dependency$name, dependency$version, sep = "-")
}
else dependency$name
target_dir <- file.path(outputDir, target_dir)
if (htmltools:::dir_exists(target_dir))
unlink(target_dir, recursive = TRUE)
dir.create(target_dir)
files <- if (dependency$all_files)
list.files(dir)
else {
unlist(dependency[c("script", "stylesheet", "attachment")])
}
browser()
srcfiles <- file.path(dir, files) #<------
destfiles <- file.path(target_dir, files) #<------
isdir <- file.info(srcfiles)$isdir #<------
destfiles <- ifelse(isdir, dirname(destfiles), destfiles) #<------
mapply(function(from, to, isdir) {
if (!htmltools:::dir_exists(dirname(to)))
dir.create(dirname(to), recursive = TRUE)
if (isdir && !htmltools:::dir_exists(to))
dir.create(to)
file.copy(from, to, overwrite = TRUE, recursive = isdir)
}, srcfiles, destfiles, isdir)
dependency$src$file <- normalizePath(target_dir, "/", TRUE)
dependency
}
i am trying to save trelliscopejs output to an html to nest it in slickR.
after looking a bit i figured out that the structure of an output object is missing a few attribrutes.
this got me a bit farther down the script.
but then i found that the
inst/htmlwidgets
structure doesnt conform to what is in the saveWidget script, more specifically the functionhtmltools:::copyDependencyToDir()
How could i change things to make
saveWidget
run?Thanks
see 4 lines after
browser()
the functions that depend on this are
save_html
:and
saveWidget
: