eval_term_as_filepath ~config ~initiator term evaluates the term term into a file path.
The evaluation starts at the initiator's basedir which defaults to ".", then scans the term term from left to right, appending to the path as it goes. However, when a directory variable like "${HOME}" or "${SLOT.slotname}" is encountered, the evaluation ignoring any previously-encountered paths, jumps directly to that directory, and continues from there.
So "a/b/c/${HOME}/d/e" becomes "${HOME}/d/e", and "a/b/c/${SLOT.slotname}/d/e" becomes "${SLOT.slotname}/d/e".
And if relative_path = Some "x/y/z" then "a/b/c" becomes "x/y/z/a/b/c", and "${HOME}/d/e" becomes "${HOME}/d/e".
The initiator helps resolve directory paths like "${SLOT.slotname}".
The ~platform overrides how slashes are handled. If ~platform = `Windows then backslash is the directory separator. If ~platform = `Unix then forward slash is the directory separator. If ~platform is not provided, then the slashes are inferred from the slashes provided in the term. You should prefer not setting the ~platform parameter unless you intend to display both platforms to the end-user.