CSplitpath:SetFilename CSplitpath:SetFolder

CSplitpath:SetFilenameExt


The SetFilenameExt method sets the file name and extension components of the CSplitpath object. The File name + extension is passed as a single string in the format 'filename.ext'. Use Merge to combine this component and the other components into a full path.

Syntax

bSuccess = CSplitpath:SetFilenameExt( sNameExt )

 

    On success, this method returns true.

    On failure, this method returns false.

Example

Suppose a file exists with a full path named sPath. The following script fragment creates a new path using a different file name and extension named sNewNameExt:

 

S = CSplitpath:new()

-- create a CSplitpath object

S:SetPath(sPath)

-- set the starting path

S:SetFilenameExt(sNewNameExt)

-- assign a new file name and extension

S:Merge()

-- combine the path components

  ...

-- do something with the new path

S:delete()

-- when done with S, remove it from memory

Related Topics

CSplitpath, GetFilenameExt