CSplitpath:SetPath CSplitpath:Split

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 )

 

Example

Suppose a file exists with a full path named sPath. The following script fragment creates a new path by adding the subdirectory named sSubdir:

 

S = CSplitpath:new()

-- create a CSplitpath object

S:SetPath(sPath)

-- set the starting path

S:SetSubdir(sSubdir)

-- append the directory with additional subdirectories

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, GetDir