Skip to main content

write_target

Function write_target 

Source
pub fn write_target(
    root: Option<&Path>,
    explicit: Option<&Path>,
    base: Option<&Path>,
    profile: Option<&str>,
) -> Option<PathBuf>
Expand description

The file a config write lands in (#571).

An explicit --config is that file and nothing else. Under --profile <name> it is the profile’s own overlay, because that is the file whose keys win for that profile: writing the shared base while an overlay pinned the same key left the effective value untouched, so config set provider.model … printed the overlay’s old value and the profile kept serving it. default — and no profile at all — is the base file, because that profile is the base file.

One answer for both writers: config set/config unset/mcp add on the command line and the dashboard’s settings and MCP panes. Two answers is how one of them came to write the wrong file.

The directory is not created here: a read asks this question too, and a read must not make one. A caller that writes makes the directory for its own profile first. root is where profiles/ lives (home_root), explicit is a --config the person gave, base is the file a load reads first, and profile is the profile in force.