MCPcopy Create free account
hub / github.com/PerroEngine/Perro / save_asset

Function save_asset

perro_source/io_stack/perro_io/src/asset_io.rs:454–472  ·  view source on GitHub ↗

Save an asset (disk only)

(path: &str, data: &[u8])

Source from the content-addressed store, hash-verified

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 }

Callers 4

save_bytesFunction · 0.85
save_csv_sourceMethod · 0.85
scene_save_docMethod · 0.85
mic_save_wavMethod · 0.85

Calls 6

save_web_user_assetFunction · 0.85
parentMethod · 0.80
write_allMethod · 0.80
resolve_pathFunction · 0.70
createFunction · 0.50

Tested by

no test coverage detected