Skip to main content

is_wrapper_launcher

Function is_wrapper_launcher 

Source
pub fn is_wrapper_launcher(
    candidate: &Path,
    own_executable: Option<&Path>,
) -> bool
Expand description

What: Report whether the candidate is a toolchain launcher of this wrapper: a file with a launch record beside it that names this wrapper. The record is looked for beside the candidate’s own name and beside the file its links finally lead to. Why: A launcher replaces itself with the wrapper’s executable, which is another file with other bytes, so the file checks of the identity test miss it; the record beside it says what it leads to. A symlink named git that points at a launcher has no record of its own, so the file it leads to is checked as well.

In TS you’d write (pseudocode):

function isWrapperLauncher(candidate: string, own?: string): boolean {
  return [candidate, realpathOrUndefined(candidate)].some((p) => p && recordNamesThisWrapper(readOrUndefined(p + '.launch'), own));
}