Prompt the user for the path to a file or folder, using the system file dialogs with RStudio Desktop, and RStudio's own dialogs with RStudio Server.
selectFile(
caption = "Select File",
label = "Select",
path = getActiveProject(),
filter = "All Files (*)",
existing = TRUE
)
selectDirectory(
caption = "Select Directory",
label = "Select",
path = getActiveProject()
)
The window title.
The label to use for the 'Accept' / 'OK' button.
The initial working directory, from which the file dialog should begin browsing. Defaults to the current RStudio project directory.
A glob filter, to be used when attempting to open a file with a
particular extension. For example, to scope the dialog to R files, one could use
R Files (*.R)
here.
Boolean; should the file dialog limit itself to existing files on the filesystem, or allow the user to select the path to a new file?
When the selected file resolves within the user's home directory,
RStudio will return an aliased path -- that is, prefixed with ~/
.
The selectFile
and selectDirectory
functions were
added in version 1.1.287 of RStudio.