FileOps.$splitpathname()

Function group Execute on client Platform(s)
FileOps NO All

Syntax

FileOps.$splitpathname(cPath, &cDriveName, [&cDirectoryName, &cFileName, &cFileExtension])

Description

Splits the path cPath into cDriveName, cDirectoryName, cFileName, and cFileExtension. Pathnames can be over 255 characters (the limit in Studio 8.0.1 or earlier): the last three parameters are optional (from Studio 10.0.1 onwards).

The function returns zero if successful, or an error code: see the FileOps function error codes.

Example

Do  sys(10) Returns lPath
# returns the name and path of current library

Do FileOps.$splitpathname(lPath,lDrive,lDirName,lFilename,lFileExtnReturns lError
# under Windows, when lPath = 'C:\OMNIS\EXAMPLES\EXTCOMP.LBS'
# lDrive returns C:
# lDirName returns \OMNIS\EXAMPLES\
# lFileName returns EXTCOMP
# lFileExtn returns .LBS

Do FileOps.$splitpathname('c:\omnis',lDrive,lDirName,lFilename,lFileExtnReturns lError
# under Windows
# lDrive returns C:
# lDirName returns \
# lFileName returns OMNIS
# lFileExtn returns (empty)

Do FileOps.$splitpathname(
'HD/Omnis/Examples/Extcomp.lbs',lDrive,lDirName,lFilename,lFileExtnReturns lError
# under macOS ## note the separator is /, not :
# lDrive returns HD
# lDirName returns /Omnis/Examples/
# lFileName returns Extcomp
# lFileExtn returns .lbs

Do FileOps.$splitpathname('/omnis/examples/extcomp.lbs',lDrive,lDirName,lFilename,lFileExtnReturns lError
# under Linux
# lDrive returns (empty)
# lDirName returns /omnis/examples
# lFileName returns extcomp
# lFileExtn returns .lbs