Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

dlg_dir

Modal dialog to select a directory.


Description

Select an existing directory, or create a new one.

Usage

dlg_dir(default = getwd(), title, ..., gui = .GUI)

dlgDir(default = getwd(), title, ..., gui = .GUI)

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

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

## S3 method for class 'nativeGUI'
dlgDir(
  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

Examples

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

## End(Not run)

svDialogs

SciViews - Standard Dialog Boxes for Windows, MacOS and Linuxes

v1.0.3
GPL-2
Authors
Philippe Grosjean [aut, cre] (<https://orcid.org/0000-0002-2694-9471>), Paul Hibbins [ctb]
Initial release
2021-04-16

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.