Copies a SQLite database file together with any `-wal`/`-shm` sidecars.
(src: &Path, dest: &Path)
| 370 | |
| 371 | /// Copies a SQLite database file together with any `-wal`/`-shm` sidecars. |
| 372 | fn copy_db_files(src: &Path, dest: &Path) -> io::Result<()> { |
| 373 | fs::copy(src, dest)?; |
| 374 | for suffix in ["-wal", "-shm"] { |
| 375 | let sidecar = sibling_with_suffix(src, suffix); |
| 376 | if sidecar.exists() { |
| 377 | fs::copy(&sidecar, sibling_with_suffix(dest, suffix))?; |
| 378 | } |
| 379 | } |
| 380 | Ok(()) |
| 381 | } |
| 382 | |
| 383 | fn sibling_with_suffix(path: &Path, suffix: &str) -> PathBuf { |
| 384 | let mut name = path.file_name().unwrap_or_default().to_os_string(); |
no test coverage detected