Skip to main content

write_bookmarks

Function write_bookmarks 

Source
pub fn write_bookmarks(
    path: &Path,
    bookmarks: &[BrowserBookmark],
) -> Result<(), String>
Expand description

Write the whole bookmarks list, replacing whatever was there before — the same wholesale-replace shape as widget:pinned’s SetConfigCommand convention, just pointed at this dedicated file instead of settings.json. Writes to a per-call unique temp file then renames over the real path, so a crash or concurrent write never leaves a half-written, corrupt browser-bookmarks.json behind (mirrors the tmp-then-rename pattern used for native-memory file writes in bundle_import_for_agent_impl). Two windows writing at the same instant still race at the whole-file level — last write wins, no merge — an accepted limitation, not something this function tries to solve.