stripDrive

Strips the drive from a Windows path. On POSIX, the path is returned unaltered.

  1. auto stripDrive(R path)
    stripDrive
    (
    R
    )
    ()
    if (
    isRandomAccessRange!R &&
    hasSlicing!R
    &&
    isSomeChar!(ElementType!R)
    &&
    )
  2. auto stripDrive(C[] path)

Parameters

path R

A pathname

Return Value

Type: auto

A slice of path without the drive component.

Examples

version (Windows)
{
    assert(stripDrive(`d:\dir\file`) == `\dir\file`);
    assert(stripDrive(`\\server\share\dir\file`) == `\dir\file`);
}

Meta