Save an asset (disk only)
(path: &str, data: &[u8])
| 452 | } |
| 453 | |
| 454 | if let Some(rest) = path.strip_prefix("dlc://") { |
| 455 | let (mount_raw, rel_raw) = rest.split_once('/').unwrap_or((rest, "")); |
| 456 | let rel = rel_raw.trim_start_matches('/'); |
| 457 | let mount_name = if mount_raw.eq_ignore_ascii_case("self") { |
| 458 | DLC_SELF_CONTEXT.with(|ctx| ctx.borrow().clone()) |
| 459 | } else { |
| 460 | Some(mount_raw.to_ascii_lowercase()) |
| 461 | }; |
| 462 | if let Some(name) = mount_name |
| 463 | && let Some(mount) = DLC_MOUNTS |
| 464 | .read() |
| 465 | .expect("required value must be present") |
| 466 | .get(&name) |
| 467 | { |
| 468 | return match &mount.source { |
| 469 | DlcMountSource::Disk(root) => ResolvedPath::Disk(root.join(rel)), |
| 470 | DlcMountSource::Archive(_) => { |
| 471 | if is_static_binary_path(rel) { |
| 472 | ResolvedPath::DlcStaticBinary { |
| 473 | dlc: name, |
| 474 | path: format!("dlc://{}/{rel}", mount.name), |
| 475 | } |
no test coverage detected