Skip to main content

plain

Function plain 

Source
pub fn plain(text: &str) -> String
Expand description

A path as a person or an agent should read it.

std::fs::canonicalize on Windows returns the verbatim form — \\?\C:\work\api\src\lock.rs, or \\?\UNC\server\share\... for a network path — which is what the store holds and what the long-path APIs need. It is not what an editor opens, what a shell completes, or what anybody pastes back: every locator semlith printed on Windows was unusable (#74).

The store keeps the verbatim form, because that is what makes a path longer than 260 characters work. Only the text on its way out is plain, and semlith read takes either.

A dozen lines rather than a crate: this runs on every hit and every row, and the rule is two prefixes.

Applied where a path is rendered — serialize_plain for everything that goes out as JSON, display for the CLI’s text — and never where one is stored or looked up. A stripped path is not the key the store holds, and a row’s own path is what the next query uses to fetch its text.