Expand description
Sidecar file that pins the --shell logic dylib path at install time.
cargo truce install --shell writes one of these per plugin; the
shell binary loaded by the DAW reads it at first hot-reload to find
the matching logic dylib.
§Path layout
~/.truce/shell/<crate_name>.path<crate_name> matches the consuming crate’s CARGO_PKG_NAME. The
file content is one line: the absolute path to the logic dylib
(e.g. /Users/me/projects/my-plugin/target/shell/libmy_plugin.dylib).
No TOML / no JSON — a single path keeps both writer and reader
trivial and parser-free.
§Why ~/.truce/ and not the bundle
Per-bundle sidecars (e.g. MyPlugin.clap/Contents/.truce-shell)
were considered, but the runtime read would need dladdr /
GetModuleFileName to locate the shell binary’s own path on disk.
Putting the sidecar at a crate_name-keyed home-relative path
sidesteps that: the shell binary already has env!("CARGO_PKG_NAME")
baked at compile time, so the read site needs only $HOME plus the
crate name. Trade-off: only one shell install per crate at a time,
which is fine — the only reason to install the same plugin twice is
beta/release coexistence, and shell-mode is a dev-loop feature.
Functions§
- sidecar_
path - Resolve
$HOME/.truce/shell/<crate_name>.pathfor a given crate.crate_nameis the consuming crate’sCARGO_PKG_NAME— the reader passesenv!("CARGO_PKG_NAME")and the writer passes the resolved plugin’scrate_namefromtruce.toml. ReturnsNonewhen neitherHOME(Unix) norUSERPROFILE(Windows) is set — the caller should fail loud rather than guess a path.