is_windows_drive: Is the path a Windows drive?

Description Usage Arguments Value Note See Also Examples

View source: R/windows.R

Description

Checks to see if the path is a Windows drive.

Usage

1

Arguments

x

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

Value

A logical vector, TRUE when the path is a Windows drive name. On non-Windows machines, the return value is FALSE everywhere.

Note

The check is done by regular expression: values are considered to be Windows drive name if they consist of a letter followed by a colon, optionally followed by a slash or backslash. Paths are standardardized before checking, so . and .. are resolved to their actual locations rather than always returning FALSE.

See Also

get_drive

Examples

1
2
3
x <- c("c:", "c:/", "c:\\", "C:", "C:/", "C:\\", "c:/c", "cc:", NA)
# Warnings about OS suppressed so package checks pass on non-Windows systems.
suppressWarnings(is_windows_drive(x))

richierocks/pathological documentation built on May 27, 2019, 8:47 a.m.