CSplitpath:GetDir CSplitpath:GetExt

CSplitpath:GetDrive


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

Syntax

sDrive = CSplitpath:GetDrive()

 

Example

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

 

S = CSplitpath:new()

-- create a CSplitpath object

S:SetPath(sPath)

-- Specify the path to be split

sDrive = S:GetDrive()

-- assigns the drive name component to the string sDrive.

S:delete()

-- when done with S, remove it from memory

Related Topics

CSplitpath