Skip to main content

apply_file

Function apply_file 

Source
pub fn apply_file(request: &ApplyRequest<'_>) -> Result<String, PresetError>
Expand description

Runs preset apply: reads the edit list, takes the template, applies the edits and writes the preset. Returns the report to print.

The output must carry the extension of the synth, and must not be the edit list, the template or a file in the factory folder of the synth, and must not exist unless the request sets force. The file is written to a temporary file next to it and then published: renamed with force, hard-linked without it, so a file that appears meanwhile is never replaced. A run that returns an error leaves no file, and a run killed during the write leaves at most the temporary .partial file next to the output. A folder without hard links, such as one on exFAT, gets the file through an exclusive create and a write in place instead: the file is visible while it is written, an error removes it, and a run killed during the write leaves a partial output file.

ยงErrors

A PresetError for any refused input, edit or path.