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, which was the limit in Studio 8.0.1 or earlier.

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,lFileExtn) Returns 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,lFileExtn) Returns 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,lFileExtn) Returns lError
; under macOS ;; note / separator not :
; lDrive returns HD
; lDirName returns /Omnis/Examples/
; lFileName returns Extcomp
; lFileExtn returns .lbs


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