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

Function dlc_static_lookup

perro_source/io_stack/perro_io/src/asset_io.rs:668–685  ·  view source on GitHub ↗
(
        path_hash: u64,
        data_out: *mut *const u8,
        len_out: *mut usize,
    )

Source from the content-addressed store, hash-verified

666pub 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}

Callers

nothing calls this directly

Calls 3

string_to_u64Function · 0.85
is_nullMethod · 0.80
lenMethod · 0.45

Tested by

no test coverage detected