Learn R Programming

pathological (version 0.1-1)

get_windows_drive: On Windows, return the drive of the path

Description

On a Windows system, this returns the drive letter of the path followed by a colon. On other systems, it returns a single forward slash.

Usage

get_windows_drive(x = getwd())
get_drive(x = getwd())

Arguments

x
A character vector of file paths. Defaults to the current directory.

Value

A character vector of drive paths on Windows systems, or forward slashes on Unix-based systems.

See Also

is_windows_drive

Examples

Run this code
 # often takes > 5s to run
get_windows_drive(c(".", "~", r_home(), temp_dir(), "\\\\foo/bar"))

Run the code above in your browser using DataLab