MAINSAIL Language Manual, Section 33.11

previous   next   top   contents   index   framed top   this page unframed


33.11. $decomposeFileName

Figure 33–10. $decomposeFileName
BOOLEAN
PROCEDURE   $decomposeFileName
                        (
STRING fileName;
                         
PRODUCES OPTIONAL STRING
                            
base,extension,devModStr,path;
                         
OPTIONAL BITS ctrlBits);

$decomposeFileName takes a file name and reduces it to a base, extension, a device MODULE STRING devModStr, and a path. The way the file name is parsed is device-dependent. The format of the path is the same one produced by $composePath for the device. $decomposeFileName returns TRUE if fileName is successfully decomposed, FALSE otherwise.

If a device MODULE is specified in fileName, devModStr includes the character $devModBrk at the end.

The only valid ctrlBits bit for $decomposeFileName is errorOK. If set, errMsg is not called when an error occurs.

The right way to decompose and recompose a file name completely is:

BOOLEAN bo;
STRING s,base,extension,devModStr,path,pathPrefix,
    
pathComponents;
bo := $decomposeFileName(s,base,extension,devModStr,path);
bo := $decomposePath(devModStr & path,
    
pathPrefix,pathComponents,devModStr);
path := $composePath
    (
pathPrefix,pathComponents,devModStr,$omitDevModStr);
s := $composeFileName(base,extension,devModStr,path);

previous   next   top   contents   index   framed top   this page unframed

MAINSAIL Language Manual, Section 33.11