string or range of characters
A slice of path that is the drive, or an empty range if the drive is not specified. In the case of UNC paths, the network share is returned.
Always returns an empty range on POSIX.
import std.range : empty; version (Posix) assert(driveName("c:/foo").empty); version (Windows) { assert(driveName(`dir\file`).empty); assert(driveName(`d:file`) == "d:"); assert(driveName(`d:\file`) == "d:"); assert(driveName("d:") == "d:"); assert(driveName(`\\server\share\file`) == `\\server\share`); assert(driveName(`\\server\share\`) == `\\server\share`); assert(driveName(`\\server\share`) == `\\server\share`); static assert(driveName(`d:\file`) == "d:"); }
Get the drive portion of a path.