The path Tcl parsing library module has the file name path.tcl. This module provides procedures to split and join components of a directory path.
Here is a list of procedures in the Tcl path parsing library module:
The following modules are required along with this module:
This module requires the definition file:
Declaration : proc path_split {pin has_fname drive path fname}
Parameters :
Name : pin
Type : string
Description : input path
Name : has_fname
Type : boolean flag
Description : has file name in path?
Name : drive
Type : string (single character)
Description : returned drive letter
Name : path
Type : string
Description : returned path
Name : fname
Type : string
Description : returned file name
Returns : TRUE upon success, FALSE otherwise
This procedure will split a directory path into its component parts (drive letter, path and file name). The parts are returned in the returned drive letter, returned path and returned file name. The returned drive letter is always an empty string in Unix/Linux/BSD systems. The input path must be supplied in absolute form, not in relative form. The last component of the input path is assumed to be the file name if the has file name in path flag is high. If the file name is not present, an empty string will be returned in the returned file name.
Declaration : proc path_join {drive path fname pout}
Parameters :
Name : drive
Type : string (single character)
Description : input drive letter
Name : path
Type : string
Description : input directory path
Name : fname
Type : string
Description : input file name
Name : pout
Type : string
Description : returned path
Returns : TRUE upon success, FALSE otherwise
This procedure will join a path from it's component parts (drive letter, path and file name). Under the Windows operating system, the input drive letter is required to be a single alphabetic character representing the drive letter. The input directory path must not begin with a path separator. Upon success the joined path will be placed into the returned path. The input file name may be empty which indicates no file name present.