dlg_dir: Modal dialog to select a directory.

View source: R/dlg_dir.R

dlg_dirR Documentation

Modal dialog to select a directory.

Description

Select an existing directory, or create a new one.

Usage

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

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

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

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

## S3 method for class '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$res component to get the returned directory (the string is empty when the user cancelled the dialog box, see example).

See Also

dlg_open(), dlg_save()

Examples

## Not run: 
# A quick default directory changer
setwd(dlg_dir(default = getwd())$res)

## End(Not run)

svDialogs documentation built on May 10, 2022, 9:06 a.m.