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

Function mount_dlc_disk

perro_source/io_stack/perro_io/src/asset_io.rs:127–149  ·  view source on GitHub ↗
(name: &str, root: impl AsRef<Path>)

Source from the content-addressed store, hash-verified

125 .expect("required value must be present")
126 .root
127 .as_deref()
128 .cloned()
129 .expect("Project root not set")
130}
131
132/// Parse and atomically install a project root and its archive backing.
133pub fn try_set_project_root(root: ProjectRoot) -> io::Result<()> {
134 let archive = match &root {
135 ProjectRoot::PerroAssets { data, .. } => {
136 Some(Arc::new(PerroAssetsArchive::open_from_bytes(data)?))
137 }
138 ProjectRoot::Disk { .. } => None,
139 };
140 // One stat here replaces one per `res://` resolve.
141 let has_res_dir = match &root {
142 ProjectRoot::Disk { root, .. } => root.join("res").is_dir(),
143 ProjectRoot::PerroAssets { .. } => false,
144 };
145
146 let mut state = PROJECT_ASSET_STATE
147 .write()
148 .expect("required value must be present");
149 state.root = Some(Arc::new(root));
150 state.root_has_res_dir = has_res_dir;
151 state.archive = archive;
152 Ok(())

Calls 4

is_reserved_dlc_nameFunction · 0.85
as_refMethod · 0.45
insertMethod · 0.45
writeMethod · 0.45