Add pack.png file to init command

This commit is contained in:
Moritz Hölting 2024-03-29 19:26:31 +01:00
parent 25890fc392
commit d9a4debe37
2 changed files with 15 additions and 0 deletions

BIN
assets/default-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -33,6 +33,9 @@ pub fn init(
// Create the .gitignore file
create_gitignore(path, verbose)?;
// Create the pack.png file
create_pack_png(path, verbose)?;
// Create the src directory
let src_path = path.join("src");
create_dir(&src_path, verbose)?;
@ -101,3 +104,15 @@ fn create_gitignore(path: &Path, verbose: bool) -> std::io::Result<()> {
}
Ok(())
}
fn create_pack_png(path: &Path, verbose: bool) -> std::io::Result<()> {
let pack_png = path.join("pack.png");
fs::write(&pack_png, include_bytes!("../../assets/default-icon.png"))?;
if verbose {
print_info(&format!(
"Created pack.png file at {}.",
to_absolute_path(&pack_png)?
));
}
Ok(())
}