Save the last-used sandbox name for a gateway to persistent storage.
(gateway: &str, sandbox: &str)
| 276 | |
| 277 | /// Save the last-used sandbox name for a gateway to persistent storage. |
| 278 | pub fn save_last_sandbox(gateway: &str, sandbox: &str) -> Result<()> { |
| 279 | let path = last_sandbox_path(gateway)?; |
| 280 | ensure_parent_dir_restricted(&path)?; |
| 281 | std::fs::write(&path, sandbox) |
| 282 | .into_diagnostic() |
| 283 | .wrap_err_with(|| format!("failed to write last sandbox to {}", path.display()))?; |
| 284 | Ok(()) |
| 285 | } |
| 286 | |
| 287 | /// Load the last-used sandbox name for a gateway from persistent storage. |
| 288 | /// |