CSplitpath:SetDrive


The SetDrive method sets the drive name component of the CSplitpath object. Use Merge to combine this component and the other components into a full path.

Syntax

bSuccess = CSplitpath:SetDrive( sDrive )

where

 

    sDrive is the new drive name.

    bSuccess is the returned success code. On success it is true, otherwise false.

Example

Suppose a file exists with a full path named sPath. The following script creates a new path using a different drive, named sNewDrive:

S = CSplitpath:new( sPath )

-- create a CSplitpath object for path sPath

S:SetDrive( "D" )

-- assign a new drive name, "D"

S:Merge()

-- combine Drive D into the path

Related Topics

GetDrive

CSplitpath class