CSplitpath:GetDrive


The GetDrive method returns the drive name, like C:, from a CSplitpath object.

Syntax

sDrive = CSplitpath:GetDrive()

where

 

    sDirectory is a string containing the drive name. On failure, nil is returned.

Example

Suppose a file exists with a full path named sPath. The following script retrieves the drive name component:

S = CSplitpath:new( sPath )

-- create a CSplitpath object for path sPath

sDrive = S:GetDrive()

-- returns the drive name component

Related Topics

CSplitpath class