fn reset_level(path: &Path) -> io::Result<()> {
  const TEMPLATE_DATAPACKS_PACK: &[u8] = include_bytes!("../world-template/datapacks/world-size.zip");
  const TEMPLATE_ICON_PNG: &[u8] = include_bytes!("../world-template/icon.png");
  const TEMPLATE_LEVEL_DAT: &[u8] = include_bytes!("../world-template/level.dat");

  fs::remove_dir_all(&path).ignore_err(io::ErrorKind::NotFound)?;
  fs::create_dir_all(&path)?;
  let datapacks_path = path.join("datapacks");
  fs::create_dir(&datapacks_path).ignore_err(io::ErrorKind::AlreadyExists)?;
  fs::write(datapacks_path.join("glt-mc-world-base.zip"), TEMPLATE_DATAPACKS_PACK)?;
  fs::write(path.join("icon.png"), TEMPLATE_ICON_PNG)?;
  fs::write(path.join("level.dat"), TEMPLATE_LEVEL_DAT)?;
  Ok(())
}
/// Creates a new template world at the given path, ready for amulet to load
Creates a new template world at the given path, ready for amulet to load
Creates a new template world at the given path ready for amulet to load
fn reset_level(path: &Path) -> io::Result<()> {
  const TEMPLATE_DATAPACKS_PACK: &[u8] = include_bytes!("../world-template/datapacks/world-size.zip");
  const TEMPLATE_ICON_PNG: &[u8] = include_bytes!("../world-template/icon.png");
  const TEMPLATE_LEVEL_DAT: &[u8] = include_bytes!("../world-template/level.dat");
  fs::remove_dir_all(&path).ignore_err(io::ErrorKind::NotFound)?;
  fs::create_dir_all(&path)?;
  let datapacks_path = path.join("datapacks");
  fs::create_dir(&datapacks_path).ignore_err(io::ErrorKind::AlreadyExists)?;
  fs::write(datapacks_path.join("glt-mc-world-base.zip"), TEMPLATE_DATAPACKS_PACK)?;
  fs::write(path.join("icon.png"), TEMPLATE_ICON_PNG)?;
  fs::write(path.join("level.dat"), TEMPLATE_LEVEL_DAT)?;
  Ok(())
}
fn reset_level ( path : & Path ) -> io :: Result < ( ) > { const TEMPLATE_DATAPACKS_PACK : & [ u8 ] = include_bytes ! ( " " ) ; const TEMPLATE_ICON_PNG : & [ u8 ] = include_bytes ! ( " " ) ; const TEMPLATE_LEVEL_DAT : & [ u8 ] = include_bytes ! ( " " ) ; fs :: remove_dir_all ( & path ) . ignore_err ( io :: ErrorKind :: NotFound ) ? ; fs :: create_dir_all ( & path ) ? ; let datapacks_path = path . join ( " " ) ; fs :: create_dir ( & datapacks_path ) . ignore_err ( io :: ErrorKind :: AlreadyExists ) ? ; fs :: write ( datapacks_path . join ( " " ) , TEMPLATE_DATAPACKS_PACK ) ? ; fs :: write ( path . join ( " " ) , TEMPLATE_ICON_PNG ) ? ; fs :: write ( path . join ( " " ) , TEMPLATE_LEVEL_DAT ) ? ; Ok ( ( ) ) }
Creates a new template world at the given path, ready for amulet to load
Creates a new template world at the given path ready for amulet to load
path
&Path
path
&Path