CSplitpath:SetFilename


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

Syntax

bSuccess = CSplitpath:SetFilename( sFileName )

where

 

    sFileName is the new file 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 file name sNewName:

S = CSplitpath:new( sPath )

-- create a CSplitpath object for path sPath

S:SetFilename(sNewName)

-- assign a new file name

S:Merge()

-- combine the path components

Related Topics

GetFilename

CSplitpath class