CSplitpath:SetSubdir


The SetSubdir method appends a subdirectory onto an existing path held by a CSplitpath object. For example, you may use this method to append a subdirectory name like "\Data" or "\Backup" to the current directory specified by the path. For example, C:\MyFiles\MyFile.fts would become C:\MyFiles\Data\MyFile.fts. Use Merge to combine this component and the other components into a full path.

Syntax

bSuccess = CSplitpath:SetSubdir( sSubdir )

where

 

    sPath is the new subdirectory.

    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 adds a new subdirectly named "stuff" to the current directory:

S = CSplitpath:new( sPath )

-- create a CSplitpath object for path sPath

S:SetSubdir( "stuff" )

-- append the directory with a new subdirectory

S:Merge()

-- combine the subdirectory into the path

Related Topics

GetDir

CSplitpath class