loading...

Select an existing directory, or create a new one.

dlg_dir(default = getwd(), title = "Choose a directory", ..., gui = .GUI)

dlgDir(default = getwd(), title = "Choose a directory", ..., gui = .GUI)

# S3 method for gui
dlg_dir(default = getwd(), title, ..., gui = .GUI)

# S3 method for textCLI
dlg_dir(default = getwd(), title, ..., gui = .GUI)

# S3 method for nativeGUI
dlg_dir(
  default = getwd(),
  title,
  rstudio = getOption("svDialogs.rstudio", TRUE),
  ...,
  gui = .GUI
)

Arguments

default

The path to the default directory that is proposed (e.g., current working directory).

title

A title to display on top of the dialog box.

...

Pass further arguments to methods.

gui

The 'gui' object concerned by this dialog box.

rstudio

Logical. Should 'RStudio' dialog boxes automatically be used if available? If FALSE, force using OS dialog boxes, but only in 'RStudio Desktop' (ignored in 'RStudio Server'). Can be changed globally with options(svDialogs.rstudio = TRUE|FALSE). TRUE by default.

Value

The modified 'gui' object is returned invisibly. Use its gui$rescomponent to get the returned directory (the string is empty when the user cancelled the dialog box, see example).

Examples

if (FALSE) {
# A quick default directory changer
setwd(dlg_dir(default = getwd())$res)
}