CSplitpath Class Description


The CSplitpath class is used to manipulate file paths. Use this class to replace elements of the path such as the file name, directory, file extension, etc.

A complete path name consists of the following components:

bullet.gif    Machine name

bullet.gif    Drive Name

bullet.gif    Directory Name

bullet.gif    File Name

bullet.gif    Extension

The combination of machine name, drive name, and directory name is called the "folder".

Usage

Construction

Object = new_splitpath()

Object = CSplitpath:new()

Destruction

Object:delete()

Creation - Non-class Functions

This function is normally used to create a new CSplitpath object as an alternative to the class-based new method.

new_splitpath

Creates a new instance of the CSplitpath class.

Construction and Destruction - Class Methods

new

Creates a new instance of the CSplitpath class.

delete

Deletes the instance of the CSplitpath object and deletes its image from memory.

Accessing Path Components

GetDir

Returns the directory name.

GetDrive

Returns the drive name.

GetExt

Returns the extension with a preceding period, as '.ext'.

GetExt2

Returns the extension as "ext".

GetFilename

Returns the file name without its extension.

GetFilenameExt

Returns the filename + extension.

GetName

Returns the machine name.

GetFolder

Returns the machine name + drive + directory with a trailing '\'.

GetFolder2

Returns the machine name + drive + directory without a trailing '\'.

SetDir

Sets the directory name.

SetDrive

Sets the drive name.

SetExt

Sets the extension.

SetFilename

Sets the filename.

SetFilenameExt

Sets the filename + extension.

SetFolder

Sets the folder: machine name + drive + directory.

SetName

Sets the machine name.

SetPath

Sets the full path but does not split it into components.

SetSubdir

Appends a subdirectory to the path.

Operations

Merge

Merge the components into a new path.

SetPath

Initialize the CSplitpath object with a pathname and split it into components.

Split

Split a specified path into its components.

Related Topics

 Class Methods, CStrTok class


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics, Inc. All Rights Reserved.