CSplitpath:GetDrive


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

Syntax

sDrive = CSplitpath:GetDrive()

 

bullet.gif    On success, this method returns a string containing the drive name.

bullet.gif    On failure, this method returns nil.

Example

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

S = new_splitpath()

-- 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 class


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2024 Mirametrics, Inc. All Rights Reserved.