CSplitpath:SetDir


The SetDir method sets the directory component of the CSplitpath object. The directory does not include the machine name, drive name, file name, or extension. Use Merge to combine this component and the other components into a full path.

Syntax

bSuccess = CSplitpath:SetDir( sDir )

where

 

    sDir is the new directory.

    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 directory named sNewDir:

S = CSplitpath:new( sPath )

-- create a CSplitpath object for path sPath

S:SetDir(sNewDir)

-- assign a new directory name

S:Merge()

-- combine the path components

Related Topics

GetDir

CSplitpath class