(url: &str)
| 18 | pub const SNAPSHOT_CONFIG_FILE: &str = "config.json"; |
| 19 | |
| 20 | pub fn url_to_path(url: &str) -> std::result::Result<PathBuf, MigratableError> { |
| 21 | let path: PathBuf = url |
| 22 | .strip_prefix("file://") |
| 23 | .ok_or_else(|| { |
| 24 | MigratableError::MigrateSend(anyhow!("Could not extract path from URL: {url}")) |
| 25 | }) |
| 26 | .map(|s| s.into())?; |
| 27 | |
| 28 | if !path.is_dir() { |
| 29 | return Err(MigratableError::MigrateSend(anyhow!( |
| 30 | "Destination is not a directory: {path:?}" |
| 31 | ))); |
| 32 | } |
| 33 | |
| 34 | Ok(path) |
| 35 | } |
| 36 | |
| 37 | #[cfg(all(target_arch = "x86_64", feature = "guest_debug"))] |
| 38 | pub fn url_to_file(url: &str) -> std::result::Result<PathBuf, GuestDebuggableError> { |
no test coverage detected