|
@@ -265,8 +265,8 @@ fn create_icns_file(
|
|
match icns::IconType::from_pixel_size_and_density(icon.width(), icon.height(), density) {
|
|
match icns::IconType::from_pixel_size_and_density(icon.width(), icon.height(), density) {
|
|
Some(icon_type) => {
|
|
Some(icon_type) => {
|
|
if !family.has_icon_with_type(icon_type) {
|
|
if !family.has_icon_with_type(icon_type) {
|
|
- let icon = r#try!(make_icns_image(icon));
|
|
|
|
- r#try!(family.add_icon_with_type(&icon, icon_type));
|
|
|
|
|
|
+ let icon =make_icns_image(icon)?;
|
|
|
|
+ family.add_icon_with_type(&icon, icon_type)?;
|
|
}
|
|
}
|
|
Ok(())
|
|
Ok(())
|
|
}
|
|
}
|
|
@@ -280,7 +280,7 @@ fn create_icns_file(
|
|
let mut images_to_resize: Vec<(image::DynamicImage, u32, u32)> = vec![];
|
|
let mut images_to_resize: Vec<(image::DynamicImage, u32, u32)> = vec![];
|
|
for icon_path in settings.icon_files() {
|
|
for icon_path in settings.icon_files() {
|
|
let icon_path = icon_path?;
|
|
let icon_path = icon_path?;
|
|
- let icon = r#try!(image::open(&icon_path));
|
|
|
|
|
|
+ let icon = image::open(&icon_path)?;
|
|
let density = if common::is_retina(&icon_path) { 2 } else { 1 };
|
|
let density = if common::is_retina(&icon_path) { 2 } else { 1 };
|
|
let (w, h) = icon.dimensions();
|
|
let (w, h) = icon.dimensions();
|
|
let orig_size = min(w, h);
|
|
let orig_size = min(w, h);
|
|
@@ -288,22 +288,22 @@ fn create_icns_file(
|
|
if orig_size > next_size_down {
|
|
if orig_size > next_size_down {
|
|
images_to_resize.push((icon, next_size_down, density));
|
|
images_to_resize.push((icon, next_size_down, density));
|
|
} else {
|
|
} else {
|
|
- r#try!(add_icon_to_family(icon, density, &mut family));
|
|
|
|
|
|
+ add_icon_to_family(icon, density, &mut family)?;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
for (icon, next_size_down, density) in images_to_resize {
|
|
for (icon, next_size_down, density) in images_to_resize {
|
|
let icon = icon.resize_exact(next_size_down, next_size_down, image::Lanczos3);
|
|
let icon = icon.resize_exact(next_size_down, next_size_down, image::Lanczos3);
|
|
- r#try!(add_icon_to_family(icon, density, &mut family));
|
|
|
|
|
|
+ add_icon_to_family(icon, density, &mut family)?;
|
|
}
|
|
}
|
|
|
|
|
|
if !family.is_empty() {
|
|
if !family.is_empty() {
|
|
- r#try!(fs::create_dir_all(resources_dir));
|
|
|
|
|
|
+ fs::create_dir_all(resources_dir)?;
|
|
let mut dest_path = resources_dir.clone();
|
|
let mut dest_path = resources_dir.clone();
|
|
dest_path.push(settings.bundle_name());
|
|
dest_path.push(settings.bundle_name());
|
|
dest_path.set_extension("icns");
|
|
dest_path.set_extension("icns");
|
|
- let icns_file = BufWriter::new(r#try!(File::create(&dest_path)));
|
|
|
|
- r#try!(family.write(icns_file));
|
|
|
|
|
|
+ let icns_file = BufWriter::new(File::create(&dest_path)?);
|
|
|
|
+ family.write(icns_file)?;
|
|
return Ok(Some(dest_path));
|
|
return Ok(Some(dest_path));
|
|
}
|
|
}
|
|
|
|
|