Skip to main content

Module handler

Module handler 

Source
Expand description

The Open-as-HTML handler invocation contract.

Every platform surface that registers or forwards Open as HTML spells the same two facts — how a handler launches mdo (--open plus the file), and how mdo’s binaries are found beside each other (siblings of the running executable). This module owns both; the Linux desktop-entry template, the Windows registry command builders, and the mdo-open forwarding binary are thin adapters consuming them, so a change to the invocation is made here once and every platform entry stays in step.

The file argument itself is platform presentation: a %f placeholder in a desktop entry, %1 in a Windows registry command string, and the real path when a binary is spawned. Only the argv prefix is the contract.

Constants§

OPEN_FLAGS
The flags a handler command puts before the file argument when it launches mdo directly. Spelled once: the desktop-entry template, the Windows registry command, and the forward binary all consume this, so the contract cannot drift between the six places that used to repeat it.

Functions§

open_argv
The full open-mode argv a handler spawns mdo with: the contract flags (see OPEN_FLAGS) followed by the files to open, in order.
sibling_binary
Locate a sibling binary beside the running one (or beside whichever executable the caller anchors on). This is the one discovery function and the one error mode for everything mdo ships: the binaries always run from the same directory.