Description Usage Arguments Details Value Examples
Returns a 2 element list with character vectors: drive/UNC and path, either part may contain empty strings ("") but both will have the same length as the input.
1 | path_split_drive(path)
|
path |
Character vector. |
It always holds that paste0(output[1], output[2]) == input
(note that this means that the path part is an absolute
path, including a leading slash, when a drive or UNC mountpoint is
present).
If the path contained a drive letter, the drive/UNC part will contain
everything up to and including the colon. E.g.
path_split_drive("c:/dir")
returns
list(drive = "c:", path = "/dir")
.
If the path contained a UNC path, the drive/UNC will contain the host
name and share up to but not including the fourth directory separator
character. E.g. path_split_drive("//host/computer/dir")
returns
list(drive = "//host/computer", path = "/dir")
.
Paths cannot contain both a drive letter and a UNC path.
Note that this differs from the Python os.path
module in
that UNC parts are considered drives here.
List of character vectors of length two. The first elements contain the drive letters or UNC paths, the second elements the relative paths.
1 | # path_split_drive(c("c:/Rtools/bin", "\\\\machine\\share\\folder"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.