Explorar el Código

chore: comment out image generator when not in use

Jonathan Kelley hace 3 años
padre
commit
ab99bc6c8d
Se han modificado 2 ficheros con 26 adiciones y 23 borrados
  1. 1 1
      packages/desktop/Cargo.toml
  2. 25 22
      packages/desktop/src/cfg.rs

+ 1 - 1
packages/desktop/Cargo.toml

@@ -41,4 +41,4 @@ tokio_runtime = ["tokio"]
 
 [dev-dependencies]
 dioxus-hooks = { path = "../hooks" }
-image = "0.24.0"
+# image = "0.24.0" # enable this when generating a new desktop image

+ 25 - 22
packages/desktop/src/cfg.rs

@@ -103,25 +103,28 @@ impl Default for DesktopConfig {
 
 // dirty trick, avoid introducing `image` at runtime
 // TODO: use serde when `Icon` impl serde
-#[test]
-#[ignore]
-fn prepare_default_icon() {
-    use image::io::Reader as ImageReader;
-    use image::ImageFormat;
-    use std::fs::File;
-    use std::io::Cursor;
-    use std::io::Write;
-    use std::path::PathBuf;
-    let png: &[u8] = include_bytes!("default_icon.png");
-    let mut reader = ImageReader::new(Cursor::new(png));
-    reader.set_format(ImageFormat::Png);
-    let icon = reader.decode().unwrap();
-    let bin = PathBuf::from(file!())
-        .parent()
-        .unwrap()
-        .join("default_icon.bin");
-    println!("{:?}", bin);
-    let mut file = File::create(bin).unwrap();
-    file.write_all(icon.as_bytes()).unwrap();
-    println!("({}, {})", icon.width(), icon.height())
-}
+//
+// This function should only be enabled when generating new icons.
+//
+// #[test]
+// #[ignore]
+// fn prepare_default_icon() {
+//     use image::io::Reader as ImageReader;
+//     use image::ImageFormat;
+//     use std::fs::File;
+//     use std::io::Cursor;
+//     use std::io::Write;
+//     use std::path::PathBuf;
+//     let png: &[u8] = include_bytes!("default_icon.png");
+//     let mut reader = ImageReader::new(Cursor::new(png));
+//     reader.set_format(ImageFormat::Png);
+//     let icon = reader.decode().unwrap();
+//     let bin = PathBuf::from(file!())
+//         .parent()
+//         .unwrap()
+//         .join("default_icon.bin");
+//     println!("{:?}", bin);
+//     let mut file = File::create(bin).unwrap();
+//     file.write_all(icon.as_bytes()).unwrap();
+//     println!("({}, {})", icon.width(), icon.height())
+// }