Skip to main content

write_file

Function write_file 

Source
pub fn write_file(
    cfg: &Config,
    env: EnvFn<'_>,
    which: Which,
    text: &str,
) -> Result<Editable>
Expand description

Write one of the three, then answer with the file as it now stands.

The two prose files go through [crate::memory::write_file_atomically] — temp in the same directory, then rename. MEMORY.md goes through crate::memory::Memory, because that type owns its lock and its budget: a third writer with its own fs::write would be a writer the memory tool cannot see, and the lock would be theatre.

text is stored as given. For MEMORY.md that means the §-separated file the page was shown; it is parsed and re-rendered by the same functions the tool uses, so a save cannot invent a separator style of its own.