Next: , Previous: , Up: parser-tools unix-pathnames   [Index]


54.1.4 Converting Unix pathnames

The following bindings are exported by the library (vicare parser-tools unix-pathnames).

Function: string/bytevector->pathname-bytevector obj
Function: string/bytevector->pathname-bytevector obj who

Convert the string or bytevector obj to a bytevector representation of a pathname; when successful return a bytevector, if an error occurs raise an exception with compound condition object of types: &unix-pathname-parser-error, &who, &message, &irritants using the optional who as value for the condition object of type &who.

When obj is a string: only characters whose Unicode code point is in the range [1, 255] are accepted, notice that zero is excluded; in this case a new bytevector is returned. An empty string is equivalent to a pathname segment representing the current directory: the return value is #vu8(46).

When obj is a bytevector: all the octets are accepted, with the exception of the octet zero; in this case obj itself is returned. An empty bytevector is equivalent to a pathname segment representing the current directory: the return value is #vu8(46).

Function: pathname-bytevector->string obj
Function: pathname-bytevector->string obj who

Convert the bytevector pathname representation obj to a string pathname representation; when successful return a string, if an error occurs raise an exception with compound condition object of types: &unix-pathname-parser-error, &who, &message, &irritants using the optional who as value for the condition object of type &who. An empty bytevector is equivalent to a bytevector representing the current directory: the return value is ".".

All the octets in the bytevector are considered valid, with the exception of the octet zero.