(
path_hash: u64,
data_out: *mut *const u8,
len_out: *mut usize,
)
| 666 | pub fn save_asset(path: &str, data: &[u8]) -> io::Result<()> { |
| 667 | validate_virtual_asset_path(path)?; |
| 668 | match resolve_path(path) { |
| 669 | ResolvedPath::Excluded(path) => Err(io::Error::new( |
| 670 | io::ErrorKind::PermissionDenied, |
| 671 | format!("asset `{path}` excluded from demo"), |
| 672 | )), |
| 673 | ResolvedPath::Disk(pb) => { |
| 674 | if let Some(parent) = pb.parent() { |
| 675 | fs::create_dir_all(parent)?; |
| 676 | } |
| 677 | let mut file = File::create(pb)?; |
| 678 | file.write_all(data) |
| 679 | } |
| 680 | ResolvedPath::WebUserStorage(key) => save_web_user_asset(&key, data), |
| 681 | ResolvedPath::PerroAssets(_) |
| 682 | | ResolvedPath::StaticBinary(_) |
| 683 | | ResolvedPath::DlcStaticBinary { .. } |
| 684 | | ResolvedPath::DlcPerroAssets { .. } => { |
| 685 | Err(io::Error::other("Cannot save to packed archive")) |
| 686 | } |
| 687 | } |
| 688 | } |
nothing calls this directly
no test coverage detected