# OS:Path

### Import List

        Object
        Object

Procedure Summary
BaseName(STRING): STRING Calculates the basename of pathname path.
Decode(ARRAY OF CHAR): STRING Convert a system-specific sequence of bytes path representing a file path into a string instance.
DirName(STRING): STRING Calculates the directory name of pathname path.
Encode(STRING): CharsLatin1 Encode the file path or command path as a system-specific sequence of bytes.
SplitExt(STRING, VAR STRING, VAR STRING) Splits the pathname path into a pair ``(root, ext)`' such that ``concat(root,ext) = path`'.

Procedure Detail

### BaseName

    PROCEDURE BaseName(path: STRING): STRING

> Calculates the basename of pathname path. The basename is the last pathname component of path. It never contains a slash. If path ends with a slash, then the basename is the empty string. If path does not contain a slash, then the basename equals path.

### Decode

    PROCEDURE Decode(path: ARRAY OF CHAR): STRING

> Convert a system-specific sequence of bytes path representing a file path into a string instance. This is the inverse of Encode.

### DirName

    PROCEDURE DirName(path: STRING): STRING

> Calculates the directory name of pathname path.

### Encode

    PROCEDURE Encode(path: STRING): CharsLatin1

> Encode the file path or command path as a system-specific sequence of bytes.

> The default implementation returns a string with all character codes above ``0FFX`' replaced with the character ``_`'. That is, non ISO Latin1 characters are discarded. For instances of Object.String8, it is the identity operation.

### SplitExt

    PROCEDURE SplitExt(path: STRING;
                       VAR root: STRING;
                       VAR ext: STRING)

> Splits the pathname path into a pair ``(root, ext)`' such that ``concat(root,ext) = path`'. The extension ext is empty or begins with a period and contains at most one period. The extension string does not contain a slash character.