-
Notifications
You must be signed in to change notification settings - Fork 48
Description
Hi,
I am working with shinyDirButton and shinyDirChoose to allow selection of a folder, starting from a specific default folder specified throgh defaultPath and defaultRoot. The problem is that when I then invoke parseDirPath to get the selected folder name, apparently the defaultPath value is ignored.
In practice, the returned path is
`defaultRoot/name_of_folder`
while if I get the expected functionality right, it should be:
`defaultRoot/defaultPath/name_of_folder`
Below you can find an example (not really reprex because it is related to my "paths"):
library(shiny)
library(shinyFiles)
ui <- {
volumes <- c(main = "/home/lb/")
shinyUI(fluidPage(
titlePanel("Example"),
shinyDirButton("savedir", "Save folder", "Save folder")
))
}
server <- shinyServer(function(input, output, session) {
shinyDirChoose(input, "savedir",
roots=volumes,
defaultPath = "tmp",
defaultRoot = "main",
session=session)
observeEvent(input$savedir, {
dirinfo <- parseDirPath(volumes, input$savedir)
print(dirinfo)
})
})
shinyApp(ui = ui, server = server)
If I run the example, I correctly get a "list of folders" starting from my "/home/lb/tmp" (although I see "main" on the top instead than "tmp" or "main/tmp"):
However, if I now select the "buttami" subfolder and click on "select", the path returned by
dirinfo <- parseDirPath(volumes, input$savedir)
is "/home/lb/buttami", while I would expect it to be "/home/lb/tmp/buttami"
Am I missing something/misunderstanding the functionality, here?
