(rontolisp) docs
← Functions

translate-pathname

(translate-pathname source from-wildcard to-wildcard &key)

Matches source against from-wildcard, then substitutes the pieces its wildcards captured into to-wildcard, left to right. The wildcards are the ones the rest of the pathname family understands: * (any run of characters), ? (one character) and **/ (zero or more whole directory levels). A source that does not match from-wildcard signals, as it does in Common Lisp.

A **/ is ONE wildcard, separator included: it captures the whole run of directory levels it consumed, and a **/ in to-wildcard writes that run back verbatim. Because it matches zero levels as well as many, a source with no intervening directory still translates:

Lite: matching runs over the FLAT namestring and captures are substituted POSITIONALLY rather than component by component, so a plain * may span a / where a structured implementation would stop at a directory boundary, and a to-wildcard holding fewer wildcards than from-wildcard consumes the first of them rather than the matching component.

Backend support

All four backends -- one definition in rontolisp source over primitives every backend has.