save_to_disk

Function save_to_disk 

Source
pub fn save_to_disk(path: &Path)
Expand description

What: Persist the current official index to path as JSON.

Inputs:

  • path: File path to write JSON to

Output:

  • Writes JSON to disk; errors are logged but not propagated to avoid interrupting the UI.

Details:

  • Serializes under a read lock and ensures parent directory exists before writing.
  • Creates parent directory if it doesn’t exist (Windows-compatible).
  • Logs write failures for debugging but doesn’t crash background tasks.
  • Warns if the index is empty when saving.