thomasp85/shinyFiles

Root not appearing after deploying the application

stangandaho opened this issue · 2 comments

I have developed an application using the shinyFiles package. The application runs very well on my local machine where I select folders that contain certain files. As you can see on the left, I have defined the root that bring me to my disks. But once the application is deployed, the root doesn't appear anymore and I only see computer that offers me unwanted folders.

shinyFiles issue

I tried with the defaulRoot and defaultPath arguments but the problem is not always solved. Here is my code in the UI and server side:

main_page <- tabPanel(title = "Extraction",
sidebarLayout(
sidebarPanel(
title = "Input information",
h4("Select folder containing rasters"),
shinyDirButton(id = "raster_folder", label = "Chose directory",
title = "Choose directory containing the raster images")
),
mainPanel(
tabsetPanel(
tabPanel(
title = "Plot",
plotlyOutput("plot", width = "100%", height = "400px")
)
))
))

server <- shinyServer(function(input, output, session){
shinyDirChoose(input, 'raster_folder', roots = root, filetypes=c('', 'tif'))
get_raster_path <- reactive({
parseDirPath(roots = root, selection = input$raster_folder)
})
access_all_raster <- reactive({
list.files(path = as.character(get_raster_path()), pattern = "[.TtIiFf]$", full.names = TRUE)})
})

vnijs commented

shinyFiles is designed to give you access to the file system of the computer where the application runs. This computer will be your computer when running locally and a server when running on a server. If that is not what you want you should use shiny's default fileInput

I understood, thank you!