MCPcopy Create free account
hub / github.com/aspizu/goboscript / assets

Method assets

src/codegen/sb3.rs:305–326  ·  view source on GitHub ↗
(&mut self, input: &Path)

Source from the content-addressed store, hash-verified

303 }
304
305 fn assets(&mut self, input: &Path) -> io::Result<()> {
306 let mut added = FxHashSet::default();
307 for (path, hash) in &self.costumes {
308 if added.contains(hash) {
309 continue;
310 }
311 added.insert(hash);
312 let (_, extension) = path.rsplit_once('.').unwrap();
313 self.zip
314 .start_file(format!("{hash}.{extension}"), SimpleFileOptions::default())?;
315 let file = File::open(input.join(&**path));
316 io::copy(&mut file?, &mut self.zip)?;
317 }
318 if self.srcpkg_hash.is_some() {
319 let hash = self.srcpkg_hash.take().unwrap();
320 let data = self.srcpkg.take().unwrap();
321 self.zip
322 .start_file(format!("{hash}.svg"), SimpleFileOptions::default())?;
323 self.zip.write_all(&data)?;
324 }
325 Ok(())
326 }
327
328 pub fn begin_node(&mut self, node: Node) -> io::Result<()> {
329 write_comma_io(&mut self.zip, &mut self.node_comma)?;

Callers 1

projectMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected